From 6bee36b6ebfa878e64f7fabe74f983c60a9e700f Mon Sep 17 00:00:00 2001 From: DennisDv24 Date: Sat, 30 Sep 2023 16:35:03 +0200 Subject: [PATCH 1/5] act hie component rename --- src/hie.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hie.yaml b/src/hie.yaml index c7bf6c2c..52ba6c24 100644 --- a/src/hie.yaml +++ b/src/hie.yaml @@ -1,7 +1,7 @@ cradle: cabal: - path: "." - component: "lib:act-internal" + component: "lib:act" - path: "./Main.hs" component: "exe:act" - path: "./test" From 2a9d345aeca816f49a597bdf78e4a66c3e9fbc64 Mon Sep 17 00:00:00 2001 From: Zoe Paraskevopoulou Date: Thu, 12 Oct 2023 13:50:42 +0300 Subject: [PATCH 2/5] Nits in the JSON printer (#164) * TypedExpr: nits in the JSON printer * tests: regenerate tests output * Update src/Syntax/TimeAgnostic.hs Co-authored-by: sophierain <99733455+sophierain@users.noreply.github.com> * tests: regenerate tests output * add JSON for storage and AbiType * tests: regenerate tests output --------- Co-authored-by: sophierain <99733455+sophierain@users.noreply.github.com> --- src/Syntax/TimeAgnostic.hs | 100 +- src/Syntax/Untyped.hs | 45 +- tests/frontend/pass/case/case.act.typed.json | 301 +- .../pass/creation/create.act.typed.json | 49 +- .../frontend/pass/multi/multi.act.typed.json | 346 +- .../pass/safemath/safemathraw.act.typed.json | 120 +- .../frontend/pass/smoke/smoke.act.typed.json | 50 +- .../pass/token/transfer.act.typed.json | 4108 +++++++++++------ 8 files changed, 3325 insertions(+), 1794 deletions(-) diff --git a/src/Syntax/TimeAgnostic.hs b/src/Syntax/TimeAgnostic.hs index 0f974e7e..5f7d89bf 100644 --- a/src/Syntax/TimeAgnostic.hs +++ b/src/Syntax/TimeAgnostic.hs @@ -352,24 +352,24 @@ instance Timable StorageRef where -- It was difficult to construct a function with type: -- `InvPredicate t -> Either (Exp Bool Timed,Exp Bool Timed) (Exp Bool Untimed)` instance ToJSON (Act Timed) where - toJSON (Act storages contracts) = object [ "kind" .= String "Program" + toJSON (Act storages contracts) = object [ "kind" .= String "Act" , "store" .= storeJSON storages , "contracts" .= toJSON contracts ] instance ToJSON (Act Untimed) where - toJSON (Act storages contracts) = object [ "kind" .= String "Program" + toJSON (Act storages contracts) = object [ "kind" .= String "Act" , "store" .= storeJSON storages , "contracts" .= toJSON contracts ] instance ToJSON (Contract Timed) where toJSON (Contract ctor behv) = object [ "kind" .= String "Contract" - , "constructor" .= toJSON ctor - , "behaviors" .= toJSON behv ] + , "constructor" .= toJSON ctor + , "behaviours" .= toJSON behv ] instance ToJSON (Contract Untimed) where toJSON (Contract ctor behv) = object [ "kind" .= String "Contract" - , "constructor" .= toJSON ctor - , "behaviors" .= toJSON behv ] + , "constructor" .= toJSON ctor + , "behaviours" .= toJSON behv ] storeJSON :: Store -> Value @@ -379,7 +379,7 @@ storeJSON storages = object [ "kind" .= String "Storages" instance ToJSON (Constructor Timed) where toJSON Constructor{..} = object [ "kind" .= String "Constructor" , "contract" .= _cname - , "interface" .= (String . pack $ show _cinterface) + , "interface" .= toJSON _cinterface , "preConditions" .= toJSON _cpreconditions , "postConditions" .= toJSON _cpostconditions , "invariants" .= listValue (\i@Invariant{..} -> invariantJSON i _predicate) _invariants @@ -388,7 +388,7 @@ instance ToJSON (Constructor Timed) where instance ToJSON (Constructor Untimed) where toJSON Constructor{..} = object [ "kind" .= String "Constructor" , "contract" .= _cname - , "interface" .= (String . pack $ show _cinterface) + , "interface" .= toJSON _cinterface , "preConditions" .= toJSON _cpreconditions , "postConditions" .= toJSON _cpostconditions , "invariants" .= listValue (\i@Invariant{..} -> invariantJSON i _predicate) _invariants @@ -398,13 +398,26 @@ instance ToJSON (Behaviour t) where toJSON Behaviour{..} = object [ "kind" .= String "Behaviour" , "name" .= _name , "contract" .= _contract - , "interface" .= (String . pack $ show _interface) + , "interface" .= toJSON _interface , "preConditions" .= toJSON _preconditions , "case" .= toJSON _caseconditions , "postConditions" .= toJSON _postconditions , "stateUpdates" .= toJSON _stateUpdates , "returns" .= toJSON _returns ] +instance ToJSON Interface where + toJSON (Interface x decls) = object [ "kind" .= String "Interface" + , "id" .= pack (show x) + , "args" .= toJSON decls + ] + +instance ToJSON Decl where + toJSON (Decl abitype x) = object [ "kind" .= String "Declaration" + , "id" .= pack (show x) + , "abitype" .= pack (show abitype) + ] + + invariantJSON :: ToJSON pred => Invariant t -> pred -> Value invariantJSON Invariant{..} predicate = object [ "kind" .= String "Invariant" , "predicate" .= toJSON predicate @@ -413,8 +426,8 @@ invariantJSON Invariant{..} predicate = object [ "kind" .= String "Invariant" , "contract" .= _icontract ] instance ToJSON (Rewrite t) where - toJSON (Constant a) = object [ "Constant" .= toJSON a ] - toJSON (Rewrite a) = object [ "Rewrite" .= toJSON a ] + toJSON (Constant a) = object [ "constant" .= toJSON a ] + toJSON (Rewrite a) = object [ "rewrite" .= toJSON a ] instance ToJSON (StorageLocation t) where toJSON (Loc _ a) = object [ "location" .= toJSON a ] @@ -423,26 +436,33 @@ instance ToJSON (StorageUpdate t) where toJSON (Update _ a b) = object [ "location" .= toJSON a ,"value" .= toJSON b ] instance ToJSON (TStorageItem a t) where - toJSON (Item t _ a) = object [ "sort" .= pack (show t) - , "item" .= toJSON a ] + toJSON (Item t _ a) = object [ "item" .= toJSON a + , "type" .= show t + ] instance ToJSON (StorageRef t) where - toJSON (SVar _ c x) = object [ "var" .= String (pack c <> "." <> pack x) ] + toJSON (SVar _ c x) = object [ "kind" .= pack "SVar" + , "svar" .= pack x + , "contract" .= pack c ] toJSON (SMapping _ e xs) = mapping e xs - toJSON (SField _ e _ x) = field e x + toJSON (SField _ e c x) = field e c x mapping :: (ToJSON a1, ToJSON a2) => a1 -> a2 -> Value -mapping a b = object [ "symbol" .= pack "lookup" - , "arity" .= Data.Aeson.Types.Number 2 - , "args" .= Array (fromList [toJSON a, toJSON b]) ] +mapping a b = object [ "kind" .= pack "Mapping" + , "indexes" .= toJSON b + , "reference" .= toJSON a] + +field :: (ToJSON a1) => a1 -> Id -> Id -> Value +field a c x = object [ "kind" .= pack "Field" + , "field" .= pack x + , "contract" .= pack c + , "reference" .= toJSON a + ] -field :: (ToJSON a1, ToJSON a2) => a1 -> a2 -> Value -field a b = object [ "symbol" .= pack "select" - , "arity" .= Data.Aeson.Types.Number 2 - , "args" .= Array (fromList [toJSON a, toJSON b]) ] instance ToJSON (TypedExp t) where - toJSON (TExp typ a) = object [ "sort" .= pack (show typ) + toJSON (TExp typ a) = object [ "kind" .= pack "TypedExpr" + , "type" .= pack (show typ) , "expression" .= toJSON a ] instance ToJSON (Exp a t) where @@ -451,14 +471,15 @@ instance ToJSON (Exp a t) where toJSON (Exp _ a b) = symbol "^" a b toJSON (Mul _ a b) = symbol "*" a b toJSON (Div _ a b) = symbol "/" a b - toJSON (LitInt _ a) = toJSON $ show a + toJSON (LitInt _ a) = object [ "literal" .= pack (show a) + , "type" .= pack "int" ] toJSON (IntMin _ a) = toJSON $ show $ intmin a toJSON (IntMax _ a) = toJSON $ show $ intmax a toJSON (UIntMin _ a) = toJSON $ show $ uintmin a toJSON (UIntMax _ a) = toJSON $ show $ uintmax a - toJSON (InRange _ a b) = object [ "symbol" .= pack ("inrange" <> show a) - , "arity" .= Data.Aeson.Types.Number 1 - , "args" .= Array (fromList [toJSON b]) ] + toJSON (InRange _ a b) = object [ "symbol" .= pack "inrange" + , "arity" .= Data.Aeson.Types.Number 2 + , "args" .= Array (fromList [String (pack $ show a), toJSON b]) ] toJSON (IntEnv _ a) = String $ pack $ show a toJSON (ITE _ a b c) = object [ "symbol" .= pack "ite" , "arity" .= Data.Aeson.Types.Number 3 @@ -472,7 +493,8 @@ instance ToJSON (Exp a t) where toJSON (Eq _ _ a b) = symbol "==" a b toJSON (LEQ _ a b) = symbol "<=" a b toJSON (GEQ _ a b) = symbol ">=" a b - toJSON (LitBool _ a) = String $ pack $ show a + toJSON (LitBool _ a) = object [ "literal" .= pack (show a) + , "type" .= pack "bool" ] toJSON (Neg _ a) = object [ "symbol" .= pack "not" , "arity" .= Data.Aeson.Types.Number 1 , "args" .= Array (fromList [toJSON a]) ] @@ -481,18 +503,24 @@ instance ToJSON (Exp a t) where toJSON (Slice _ s a b) = object [ "symbol" .= pack "slice" , "arity" .= Data.Aeson.Types.Number 3 , "args" .= Array (fromList [toJSON s, toJSON a, toJSON b]) ] - toJSON (ByStr _ a) = toJSON a - toJSON (ByLit _ a) = String . pack $ show a - toJSON (ByEnv _ a) = String . pack $ show a - - toJSON (TEntry _ t a) = object [ fromString (show t) .= toJSON a ] - toJSON (Var _ _ _ a) = toJSON a + toJSON (ByStr _ a) = object [ "bytestring" .= toJSON a + , "type" .= pack "bool" ] + toJSON (ByLit _ a) = object [ "literal" .= pack (show a) + , "type" .= pack "bytestring" ] + toJSON (ByEnv _ a) = object [ "ethEnv" .= pack (show a) + , "type" .= pack "bytestring" ] + toJSON (TEntry _ t a) = object [ "entry" .= toJSON a + , "timing" .= show t ] + toJSON (Var _ t _ a) = object [ "var" .= toJSON a + , "type" .= show t ] toJSON (Create _ f xs) = object [ "symbol" .= pack "create" - , "arity" .= Data.Aeson.Types.Number 2 - , "args" .= Array (fromList [object [ "fun" .= String (pack f) ], toJSON xs]) ] + , "arity" .= Data.Aeson.Types.Number 2 + , "args" .= Array (fromList [object [ "fun" .= String (pack f) ], toJSON xs]) ] toJSON v = error $ "todo: json ast for: " <> show v + + symbol :: (ToJSON a1, ToJSON a2) => String -> a1 -> a2 -> Value symbol s a b = object [ "symbol" .= pack s , "arity" .= Data.Aeson.Types.Number 2 diff --git a/src/Syntax/Untyped.hs b/src/Syntax/Untyped.hs index 1b10feee..9c15bd45 100644 --- a/src/Syntax/Untyped.hs +++ b/src/Syntax/Untyped.hs @@ -7,9 +7,10 @@ module Syntax.Untyped (module Syntax.Untyped) where import Data.Aeson import Data.List (intercalate) -import Data.List.NonEmpty (toList, NonEmpty) +import Data.List.NonEmpty (NonEmpty) +import Data.Text as T (pack) -import EVM.ABI (AbiType) +import EVM.ABI (AbiType(..)) import Lex type Pn = AlexPosn @@ -154,6 +155,7 @@ instance Show SlotType where <> ")") (show t) s + data StorageVar = StorageVar Pn SlotType Id deriving (Eq, Show) @@ -164,10 +166,41 @@ instance Show Decl where show (Decl t a) = show t <> " " <> a instance ToJSON SlotType where - toJSON (StorageValue t) = object ["type" .= show t] - toJSON (StorageMapping ixTypes valType) = object [ "type" .= String "mapping" - , "ixTypes" .= show (toList ixTypes) - , "valType" .= show valType] + toJSON (StorageValue t) = object ["kind" .= String "ValueType" + , "valueType" .= toJSON t] + toJSON (StorageMapping ixTypes resType) = object [ "kind" .= String "MappingType" + , "ixTypes" .= toJSON ixTypes + , "resType" .= toJSON resType] + + +instance ToJSON ValueType where + toJSON (ContractType c) = object [ "kind" .= String "ContractType" + , "name" .= show c ] + toJSON (PrimitiveType abiType) = object [ "kind" .= String "AbiType" + , "abiType" .= toJSON abiType ] + + +instance ToJSON AbiType where + toJSON (AbiUIntType n) = object [ "type" .= String "UInt" + , "size" .= String (T.pack $ show n) ] + toJSON (AbiIntType n) = object [ "type" .= String "Int" + , "size" .= String (T.pack $ show n) ] + toJSON AbiAddressType = object [ "type" .= String "Address" ] + toJSON AbiBoolType = object [ "type" .= String "Bool" ] + toJSON (AbiBytesType n) = object [ "type" .= String "Bytes" + , "size" .= String (T.pack $ show n) ] + toJSON AbiBytesDynamicType = object [ "type" .= String "BytesDynamic" ] + toJSON AbiStringType = object [ "type" .= String "String" ] + toJSON (AbiArrayDynamicType t) = object [ "type" .= String "ArrayDynamic" + , "arrayType" .= toJSON t ] + toJSON (AbiArrayType n t) = object [ "type" .= String "Array" + , "arrayType" .= toJSON t + , "size" .= String (T.pack $ show n) ] + toJSON (AbiTupleType ts) = object [ "type" .= String "Tuple" + , "elemTypes" .= toJSON ts ] + toJSON (AbiFunctionType) = object [ "type" .= String "Function" ] + + -- Create the string that is used to construct the function selector makeIface :: Interface -> String diff --git a/tests/frontend/pass/case/case.act.typed.json b/tests/frontend/pass/case/case.act.typed.json index bf8909fc..0de11f7a 100644 --- a/tests/frontend/pass/case/case.act.typed.json +++ b/tests/frontend/pass/case/case.act.typed.json @@ -1,20 +1,36 @@ { "contracts": [ { - "behaviors": [ + "behaviours": [ { "case": [ { "args": [ - "z", - "0" + { + "type": "int", + "var": "z" + }, + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" } ], "contract": "C", - "interface": "bar(uint256 z)", + "interface": { + "args": [ + { + "abitype": "uint256", + "id": "\"z\"", + "kind": "Declaration" + } + ], + "id": "\"bar\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "bar", "postConditions": [], @@ -22,7 +38,10 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -31,15 +50,24 @@ "args": [ { "args": [ - "0", - "z" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "z" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "z", + { + "type": "int", + "var": "z" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -53,14 +81,20 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -69,12 +103,15 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -89,7 +126,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -111,14 +151,19 @@ "returns": null, "stateUpdates": [ { - "Rewrite": { + "rewrite": { "location": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" + "type": "int" }, - "value": "z" + "value": { + "type": "int", + "var": "z" + } } } ] @@ -127,15 +172,31 @@ "case": [ { "args": [ - "z", - "1" + { + "type": "int", + "var": "z" + }, + { + "literal": "1", + "type": "int" + } ], "arity": 2, "symbol": "==" } ], "contract": "C", - "interface": "bar(uint256 z)", + "interface": { + "args": [ + { + "abitype": "uint256", + "id": "\"z\"", + "kind": "Declaration" + } + ], + "id": "\"bar\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "bar", "postConditions": [], @@ -143,7 +204,10 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -152,15 +216,24 @@ "args": [ { "args": [ - "0", - "z" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "z" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "z", + { + "type": "int", + "var": "z" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -174,14 +247,20 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -190,12 +269,15 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -210,7 +292,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -232,17 +317,25 @@ "returns": null, "stateUpdates": [ { - "Rewrite": { + "rewrite": { "location": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" + "type": "int" }, "value": { "args": [ - "z", - "1" + { + "type": "int", + "var": "z" + }, + { + "literal": "1", + "type": "int" + } ], "arity": 2, "symbol": "+" @@ -255,15 +348,31 @@ "case": [ { "args": [ - "z", - "1" + { + "type": "int", + "var": "z" + }, + { + "literal": "1", + "type": "int" + } ], "arity": 2, "symbol": ">" } ], "contract": "C", - "interface": "bar(uint256 z)", + "interface": { + "args": [ + { + "abitype": "uint256", + "id": "\"z\"", + "kind": "Declaration" + } + ], + "id": "\"bar\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "bar", "postConditions": [], @@ -271,7 +380,10 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -280,15 +392,24 @@ "args": [ { "args": [ - "0", - "z" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "z" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "z", + { + "type": "int", + "var": "z" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -302,14 +423,20 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -318,12 +445,15 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -338,7 +468,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -360,17 +493,25 @@ "returns": null, "stateUpdates": [ { - "Rewrite": { + "rewrite": { "location": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" + "type": "int" }, "value": { "args": [ - "z", - "2" + { + "type": "int", + "var": "z" + }, + { + "literal": "2", + "type": "int" + } ], "arity": 2, "symbol": "+" @@ -386,14 +527,23 @@ { "location": { "item": { - "var": "C.x" + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "sort": "int" + "type": "int" }, - "value": "0" + "value": { + "literal": "0", + "type": "int" + } } ], - "interface": "C()", + "interface": { + "args": [], + "id": "\"C\"", + "kind": "Interface" + }, "invariants": [], "kind": "Constructor", "postConditions": [], @@ -402,14 +552,21 @@ "kind": "Contract" } ], - "kind": "Program", + "kind": "Act", "store": { "kind": "Storages", "storages": { "C": { "x": [ { - "type": "uint256" + "kind": "ValueType", + "valueType": { + "abiType": { + "size": "256", + "type": "UInt" + }, + "kind": "AbiType" + } }, 0 ] diff --git a/tests/frontend/pass/creation/create.act.typed.json b/tests/frontend/pass/creation/create.act.typed.json index 240692e8..27902efa 100644 --- a/tests/frontend/pass/creation/create.act.typed.json +++ b/tests/frontend/pass/creation/create.act.typed.json @@ -1,30 +1,41 @@ { "contracts": [ { - "behaviors": [], + "behaviours": [], "constructor": { "contract": "Modest", "initial storage": [ { "location": { "item": { - "var": "Modest.x" + "contract": "Modest", + "kind": "SVar", + "svar": "x" }, - "sort": "int" + "type": "int" }, - "value": "1" + "value": { + "literal": "1", + "type": "int" + } }, { "location": { "item": { - "var": "Modest.y" + "contract": "Modest", + "kind": "SVar", + "svar": "y" }, - "sort": "int" + "type": "int" }, "value": "Caller" } ], - "interface": "Modest()", + "interface": { + "args": [], + "id": "\"Modest\"", + "kind": "Interface" + }, "invariants": [], "kind": "Constructor", "postConditions": [], @@ -33,7 +44,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Caller" ], "arity": 2, @@ -56,20 +70,33 @@ "kind": "Contract" } ], - "kind": "Program", + "kind": "Act", "store": { "kind": "Storages", "storages": { "Modest": { "x": [ { - "type": "uint256" + "kind": "ValueType", + "valueType": { + "abiType": { + "size": "256", + "type": "UInt" + }, + "kind": "AbiType" + } }, 0 ], "y": [ { - "type": "address" + "kind": "ValueType", + "valueType": { + "abiType": { + "type": "Address" + }, + "kind": "AbiType" + } }, 1 ] diff --git a/tests/frontend/pass/multi/multi.act.typed.json b/tests/frontend/pass/multi/multi.act.typed.json index c8ceeaed..e1ae9788 100644 --- a/tests/frontend/pass/multi/multi.act.typed.json +++ b/tests/frontend/pass/multi/multi.act.typed.json @@ -1,21 +1,30 @@ { "contracts": [ { - "behaviors": [], + "behaviours": [], "constructor": { "contract": "A", "initial storage": [ { "location": { "item": { - "var": "A.x" + "contract": "A", + "kind": "SVar", + "svar": "x" }, - "sort": "int" + "type": "int" }, - "value": "0" + "value": { + "literal": "0", + "type": "int" + } } ], - "interface": "A()", + "interface": { + "args": [], + "id": "\"A\"", + "kind": "Interface" + }, "invariants": [], "kind": "Constructor", "postConditions": [], @@ -24,13 +33,26 @@ "kind": "Contract" }, { - "behaviors": [ + "behaviours": [ { "case": [ - "True" + { + "literal": "True", + "type": "bool" + } ], "contract": "B", - "interface": "set_remote(uint256 z)", + "interface": { + "args": [ + { + "abitype": "uint256", + "id": "\"z\"", + "kind": "Declaration" + } + ], + "id": "\"set_remote\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "remote", "postConditions": [], @@ -38,7 +60,10 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -47,15 +72,24 @@ "args": [ { "args": [ - "0", - "z" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "z" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "z", + { + "type": "int", + "var": "z" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -69,21 +103,25 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ - { - "var": "B.a" - }, - "x" - ], - "arity": 2, - "symbol": "select" + "contract": "A", + "field": "x", + "kind": "Field", + "reference": { + "contract": "B", + "kind": "SVar", + "svar": "a" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -92,19 +130,20 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ - { - "var": "B.a" - }, - "x" - ], - "arity": 2, - "symbol": "select" + "contract": "A", + "field": "x", + "kind": "Field", + "reference": { + "contract": "B", + "kind": "SVar", + "svar": "a" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -119,7 +158,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -141,31 +183,47 @@ "returns": null, "stateUpdates": [ { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ - { - "var": "B.a" - }, - "x" - ], - "arity": 2, - "symbol": "select" + "contract": "A", + "field": "x", + "kind": "Field", + "reference": { + "contract": "B", + "kind": "SVar", + "svar": "a" + } }, - "sort": "int" + "type": "int" }, - "value": "z" + "value": { + "type": "int", + "var": "z" + } } } ] }, { "case": [ - "True" + { + "literal": "True", + "type": "bool" + } ], "contract": "B", - "interface": "set_remote2(uint256 z)", + "interface": { + "args": [ + { + "abitype": "uint256", + "id": "\"z\"", + "kind": "Declaration" + } + ], + "id": "\"set_remote2\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "multi", "postConditions": [], @@ -173,7 +231,10 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -182,15 +243,24 @@ "args": [ { "args": [ - "0", - "z" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "z" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "z", + { + "type": "int", + "var": "z" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -204,14 +274,20 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "var": "B.y" + "contract": "B", + "kind": "SVar", + "svar": "y" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -220,12 +296,15 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "var": "B.y" + "contract": "B", + "kind": "SVar", + "svar": "y" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -240,21 +319,25 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ - { - "var": "B.a" - }, - "x" - ], - "arity": 2, - "symbol": "select" + "contract": "A", + "field": "x", + "kind": "Field", + "reference": { + "contract": "B", + "kind": "SVar", + "svar": "a" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -263,19 +346,20 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ - { - "var": "B.a" - }, - "x" - ], - "arity": 2, - "symbol": "select" + "contract": "A", + "field": "x", + "kind": "Field", + "reference": { + "contract": "B", + "kind": "SVar", + "svar": "a" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -290,7 +374,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -312,32 +399,40 @@ "returns": null, "stateUpdates": [ { - "Rewrite": { + "rewrite": { "location": { "item": { - "var": "B.y" + "contract": "B", + "kind": "SVar", + "svar": "y" }, - "sort": "int" + "type": "int" }, - "value": "1" + "value": { + "literal": "1", + "type": "int" + } } }, { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ - { - "var": "B.a" - }, - "x" - ], - "arity": 2, - "symbol": "select" + "contract": "A", + "field": "x", + "kind": "Field", + "reference": { + "contract": "B", + "kind": "SVar", + "svar": "a" + } }, - "sort": "int" + "type": "int" }, - "value": "z" + "value": { + "type": "int", + "var": "z" + } } } ] @@ -349,18 +444,25 @@ { "location": { "item": { - "var": "B.y" + "contract": "B", + "kind": "SVar", + "svar": "y" }, - "sort": "int" + "type": "int" }, - "value": "0" + "value": { + "literal": "0", + "type": "int" + } }, { "location": { "item": { - "var": "B.a" + "contract": "B", + "kind": "SVar", + "svar": "a" }, - "sort": "contract" + "type": "contract" }, "value": { "args": [ @@ -374,7 +476,11 @@ } } ], - "interface": "B()", + "interface": { + "args": [], + "id": "\"B\"", + "kind": "Interface" + }, "invariants": [], "kind": "Constructor", "postConditions": [], @@ -383,14 +489,21 @@ "kind": "Contract" } ], - "kind": "Program", + "kind": "Act", "store": { "kind": "Storages", "storages": { "A": { "x": [ { - "type": "uint256" + "kind": "ValueType", + "valueType": { + "abiType": { + "size": "256", + "type": "UInt" + }, + "kind": "AbiType" + } }, 0 ] @@ -398,13 +511,24 @@ "B": { "a": [ { - "type": "A" + "kind": "ValueType", + "valueType": { + "kind": "ContractType", + "name": "\"A\"" + } }, 1 ], "y": [ { - "type": "uint256" + "kind": "ValueType", + "valueType": { + "abiType": { + "size": "256", + "type": "UInt" + }, + "kind": "AbiType" + } }, 0 ] diff --git a/tests/frontend/pass/safemath/safemathraw.act.typed.json b/tests/frontend/pass/safemath/safemathraw.act.typed.json index ae223cda..97bdcb4b 100644 --- a/tests/frontend/pass/safemath/safemathraw.act.typed.json +++ b/tests/frontend/pass/safemath/safemathraw.act.typed.json @@ -1,49 +1,85 @@ { "contracts": [ { - "behaviors": [ + "behaviours": [ { "case": [ - "True" + { + "literal": "True", + "type": "bool" + } ], "contract": "SafeAdd", - "interface": "add(uint256 x, uint256 y)", + "interface": { + "args": [ + { + "abitype": "uint256", + "id": "\"x\"", + "kind": "Declaration" + }, + { + "abitype": "uint256", + "id": "\"y\"", + "kind": "Declaration" + } + ], + "id": "\"add\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "add", "postConditions": [], "preConditions": [ { "args": [ + "uint256", { "args": [ - "x", - "y" + { + "type": "int", + "var": "x" + }, + { + "type": "int", + "var": "y" + } ], "arity": 2, "symbol": "+" } ], - "arity": 1, - "symbol": "inrangeuint256" + "arity": 2, + "symbol": "inrange" }, { "args": [ - "x" + "uint256", + { + "type": "int", + "var": "x" + } ], - "arity": 1, - "symbol": "inrangeuint256" + "arity": 2, + "symbol": "inrange" }, { "args": [ - "y" + "uint256", + { + "type": "int", + "var": "y" + } ], - "arity": 1, - "symbol": "inrangeuint256" + "arity": 2, + "symbol": "inrange" }, { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -52,15 +88,24 @@ "args": [ { "args": [ - "0", - "x" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "x" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "x", + { + "type": "int", + "var": "x" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -74,15 +119,24 @@ "args": [ { "args": [ - "0", - "y" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "y" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "y", + { + "type": "int", + "var": "y" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -96,7 +150,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -118,13 +175,20 @@ "returns": { "expression": { "args": [ - "x", - "y" + { + "type": "int", + "var": "x" + }, + { + "type": "int", + "var": "y" + } ], "arity": 2, "symbol": "+" }, - "sort": "int" + "kind": "TypedExpr", + "type": "int" }, "stateUpdates": [] } @@ -132,7 +196,11 @@ "constructor": { "contract": "SafeAdd", "initial storage": [], - "interface": "SafeAdd()", + "interface": { + "args": [], + "id": "\"SafeAdd\"", + "kind": "Interface" + }, "invariants": [], "kind": "Constructor", "postConditions": [], @@ -141,7 +209,7 @@ "kind": "Contract" } ], - "kind": "Program", + "kind": "Act", "store": { "kind": "Storages", "storages": { diff --git a/tests/frontend/pass/smoke/smoke.act.typed.json b/tests/frontend/pass/smoke/smoke.act.typed.json index d3dbbf40..bf4aaad5 100644 --- a/tests/frontend/pass/smoke/smoke.act.typed.json +++ b/tests/frontend/pass/smoke/smoke.act.typed.json @@ -1,13 +1,26 @@ { "contracts": [ { - "behaviors": [ + "behaviours": [ { "case": [ - "True" + { + "literal": "True", + "type": "bool" + } ], "contract": "A", - "interface": "f(uint256 x)", + "interface": { + "args": [ + { + "abitype": "uint256", + "id": "\"x\"", + "kind": "Declaration" + } + ], + "id": "\"f\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "f", "postConditions": [], @@ -16,15 +29,24 @@ "args": [ { "args": [ - "0", - "x" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "x" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "x", + { + "type": "int", + "var": "x" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -36,8 +58,12 @@ } ], "returns": { - "expression": "1", - "sort": "int" + "expression": { + "literal": "1", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" }, "stateUpdates": [] } @@ -45,7 +71,11 @@ "constructor": { "contract": "A", "initial storage": [], - "interface": "A()", + "interface": { + "args": [], + "id": "\"A\"", + "kind": "Interface" + }, "invariants": [], "kind": "Constructor", "postConditions": [], @@ -54,7 +84,7 @@ "kind": "Contract" } ], - "kind": "Program", + "kind": "Act", "store": { "kind": "Storages", "storages": { diff --git a/tests/frontend/pass/token/transfer.act.typed.json b/tests/frontend/pass/token/transfer.act.typed.json index 019e7070..e44696c2 100644 --- a/tests/frontend/pass/token/transfer.act.typed.json +++ b/tests/frontend/pass/token/transfer.act.typed.json @@ -1,20 +1,38 @@ { "contracts": [ { - "behaviors": [ + "behaviours": [ { "case": [ { "args": [ "Caller", - "to" + { + "type": "int", + "var": "to" + } ], "arity": 2, "symbol": "=/=" } ], "contract": "Token", - "interface": "transfer(uint256 value, address to)", + "interface": { + "args": [ + { + "abitype": "uint256", + "id": "\"value\"", + "kind": "Declaration" + }, + { + "abitype": "address", + "id": "\"to\"", + "kind": "Declaration" + } + ], + "id": "\"transfer\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "transfer", "postConditions": [], @@ -22,33 +40,40 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" }, { "args": [ - "value", { - "Pre": { + "type": "int", + "var": "value" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -59,7 +84,10 @@ { "args": [ "Caller", - "to" + { + "type": "int", + "var": "to" + } ], "arity": 2, "symbol": "=/=" @@ -69,34 +97,47 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "to", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "value" + { + "type": "int", + "var": "value" + } ], "arity": 2, "symbol": "+" }, { "args": [ - "2", - "256" + { + "literal": "2", + "type": "int" + }, + { + "literal": "256", + "type": "int" + } ], "arity": 2, "symbol": "^" @@ -113,15 +154,24 @@ "args": [ { "args": [ - "0", - "value" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "value" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "value", + { + "type": "int", + "var": "value" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -135,15 +185,24 @@ "args": [ { "args": [ - "0", - "to" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "to" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "to", + { + "type": "int", + "var": "to" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -157,26 +216,30 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -185,24 +248,25 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -217,26 +281,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "to", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -245,24 +316,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "to", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -277,7 +352,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -299,7 +377,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Caller" ], "arity": 2, @@ -319,53 +400,61 @@ } ], "returns": { - "expression": "1", - "sort": "int" + "expression": { + "literal": "1", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" }, "stateUpdates": [ { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" }, "value": { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "value" + { + "type": "int", + "var": "value" + } ], "arity": 2, "symbol": "-" @@ -373,48 +462,58 @@ } }, { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "to", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" }, "value": { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "to", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "value" + { + "type": "int", + "var": "value" + } ], "arity": 2, "symbol": "+" @@ -428,14 +527,32 @@ { "args": [ "Caller", - "to" + { + "type": "int", + "var": "to" + } ], "arity": 2, "symbol": "==" } ], "contract": "Token", - "interface": "transfer(uint256 value, address to)", + "interface": { + "args": [ + { + "abitype": "uint256", + "id": "\"value\"", + "kind": "Declaration" + }, + { + "abitype": "address", + "id": "\"to\"", + "kind": "Declaration" + } + ], + "id": "\"transfer\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "transfer", "postConditions": [], @@ -443,33 +560,40 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" }, { "args": [ - "value", { - "Pre": { + "type": "int", + "var": "value" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -480,7 +604,10 @@ { "args": [ "Caller", - "to" + { + "type": "int", + "var": "to" + } ], "arity": 2, "symbol": "=/=" @@ -490,34 +617,47 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "to", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "value" + { + "type": "int", + "var": "value" + } ], "arity": 2, "symbol": "+" }, { "args": [ - "2", - "256" + { + "literal": "2", + "type": "int" + }, + { + "literal": "256", + "type": "int" + } ], "arity": 2, "symbol": "^" @@ -534,15 +674,24 @@ "args": [ { "args": [ - "0", - "value" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "value" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "value", + { + "type": "int", + "var": "value" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -556,15 +705,24 @@ "args": [ { "args": [ - "0", - "to" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "to" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "to", + { + "type": "int", + "var": "to" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -578,26 +736,30 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -606,24 +768,25 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -638,26 +801,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "to", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -666,24 +836,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "to", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -698,7 +872,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -720,7 +897,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Caller" ], "arity": 2, @@ -740,51 +920,58 @@ } ], "returns": { - "expression": "1", - "sort": "int" + "expression": { + "literal": "1", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" }, "stateUpdates": [ { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" } } }, { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "to", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" } } } @@ -796,8 +983,14 @@ "args": [ { "args": [ - "src", - "dst" + { + "type": "int", + "var": "src" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "=/=" @@ -805,7 +998,10 @@ { "args": [ "Caller", - "src" + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "==" @@ -816,33 +1012,57 @@ } ], "contract": "Token", - "interface": "transferFrom(address src, address dst, uint256 amount)", + "interface": { + "args": [ + { + "abitype": "address", + "id": "\"src\"", + "kind": "Declaration" + }, + { + "abitype": "address", + "id": "\"dst\"", + "kind": "Declaration" + }, + { + "abitype": "uint256", + "id": "\"amount\"", + "kind": "Declaration" + } + ], + "id": "\"transferFrom\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "transferFrom", "postConditions": [], "preConditions": [ { "args": [ - "amount", { - "Pre": { + "type": "int", + "var": "amount" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -852,8 +1072,14 @@ "args": [ { "args": [ - "src", - "dst" + { + "type": "int", + "var": "src" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "=/=" @@ -863,34 +1089,47 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "+" }, { "args": [ - "2", - "256" + { + "literal": "2", + "type": "int" + }, + { + "literal": "256", + "type": "int" + } ], "arity": 2, "symbol": "^" @@ -908,41 +1147,55 @@ { "args": [ "Caller", - "src" + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "=/=" }, { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "-" @@ -958,7 +1211,10 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -967,15 +1223,24 @@ "args": [ { "args": [ - "0", - "src" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "src", + { + "type": "int", + "var": "src" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -989,15 +1254,24 @@ "args": [ { "args": [ - "0", - "dst" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "dst", + { + "type": "int", + "var": "dst" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -1011,15 +1285,24 @@ "args": [ { "args": [ - "0", - "amount" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "amount", + { + "type": "int", + "var": "amount" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -1033,26 +1316,30 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -1061,24 +1348,25 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -1093,30 +1381,38 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -1125,28 +1421,33 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -1161,26 +1462,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -1189,24 +1497,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -1221,26 +1533,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -1249,24 +1568,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -1281,7 +1604,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Caller" ], "arity": 2, @@ -1303,7 +1629,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -1323,101 +1652,119 @@ } ], "returns": { - "expression": "1", - "sort": "int" + "expression": { + "literal": "1", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" }, "stateUpdates": [ { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" } } }, { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" + "type": "int" } } }, { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" }, "value": { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "-" @@ -1425,48 +1772,58 @@ } }, { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" }, "value": { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "+" @@ -1483,8 +1840,14 @@ "args": [ { "args": [ - "src", - "dst" + { + "type": "int", + "var": "src" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "=/=" @@ -1492,7 +1855,10 @@ { "args": [ "Caller", - "src" + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "=/=" @@ -1504,40 +1870,54 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, { "args": [ { "args": [ - "2", - "256" + { + "literal": "2", + "type": "int" + }, + { + "literal": "256", + "type": "int" + } ], "arity": 2, "symbol": "^" }, - "1" + { + "literal": "1", + "type": "int" + } ], "arity": 2, "symbol": "-" @@ -1552,33 +1932,57 @@ } ], "contract": "Token", - "interface": "transferFrom(address src, address dst, uint256 amount)", + "interface": { + "args": [ + { + "abitype": "address", + "id": "\"src\"", + "kind": "Declaration" + }, + { + "abitype": "address", + "id": "\"dst\"", + "kind": "Declaration" + }, + { + "abitype": "uint256", + "id": "\"amount\"", + "kind": "Declaration" + } + ], + "id": "\"transferFrom\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "transferFrom", "postConditions": [], "preConditions": [ { "args": [ - "amount", { - "Pre": { + "type": "int", + "var": "amount" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -1588,8 +1992,14 @@ "args": [ { "args": [ - "src", - "dst" + { + "type": "int", + "var": "src" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "=/=" @@ -1599,34 +2009,47 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "+" }, { "args": [ - "2", - "256" + { + "literal": "2", + "type": "int" + }, + { + "literal": "256", + "type": "int" + } ], "arity": 2, "symbol": "^" @@ -1644,41 +2067,55 @@ { "args": [ "Caller", - "src" + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "=/=" }, { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "-" @@ -1694,7 +2131,10 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -1703,15 +2143,24 @@ "args": [ { "args": [ - "0", - "src" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "src", + { + "type": "int", + "var": "src" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -1725,15 +2174,24 @@ "args": [ { "args": [ - "0", - "dst" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "dst", + { + "type": "int", + "var": "dst" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -1747,15 +2205,24 @@ "args": [ { "args": [ - "0", - "amount" - ], - "arity": 2, - "symbol": "<=" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "amount" + } + ], + "arity": 2, + "symbol": "<=" }, { "args": [ - "amount", + { + "type": "int", + "var": "amount" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -1769,26 +2236,30 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -1797,24 +2268,25 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -1829,30 +2301,38 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -1861,28 +2341,33 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -1897,26 +2382,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -1925,24 +2417,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -1957,26 +2453,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -1985,24 +2488,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -2017,7 +2524,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Caller" ], "arity": 2, @@ -2039,7 +2549,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -2059,101 +2572,119 @@ } ], "returns": { - "expression": "1", - "sort": "int" + "expression": { + "literal": "1", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" }, "stateUpdates": [ { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" } } }, { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" + "type": "int" } } }, { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" }, "value": { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "-" @@ -2161,48 +2692,58 @@ } }, { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" }, "value": { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "+" @@ -2219,8 +2760,14 @@ "args": [ { "args": [ - "src", - "dst" + { + "type": "int", + "var": "src" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "=/=" @@ -2228,7 +2775,10 @@ { "args": [ "Caller", - "src" + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "=/=" @@ -2240,40 +2790,54 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, { "args": [ { "args": [ - "2", - "256" + { + "literal": "2", + "type": "int" + }, + { + "literal": "256", + "type": "int" + } ], "arity": 2, "symbol": "^" }, - "1" + { + "literal": "1", + "type": "int" + } ], "arity": 2, "symbol": "-" @@ -2288,33 +2852,57 @@ } ], "contract": "Token", - "interface": "transferFrom(address src, address dst, uint256 amount)", + "interface": { + "args": [ + { + "abitype": "address", + "id": "\"src\"", + "kind": "Declaration" + }, + { + "abitype": "address", + "id": "\"dst\"", + "kind": "Declaration" + }, + { + "abitype": "uint256", + "id": "\"amount\"", + "kind": "Declaration" + } + ], + "id": "\"transferFrom\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "transferFrom", "postConditions": [], "preConditions": [ { "args": [ - "amount", { - "Pre": { + "type": "int", + "var": "amount" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -2324,8 +2912,14 @@ "args": [ { "args": [ - "src", - "dst" + { + "type": "int", + "var": "src" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "=/=" @@ -2335,34 +2929,47 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "+" }, { "args": [ - "2", - "256" + { + "literal": "2", + "type": "int" + }, + { + "literal": "256", + "type": "int" + } ], "arity": 2, "symbol": "^" @@ -2380,41 +2987,55 @@ { "args": [ "Caller", - "src" + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "=/=" }, { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "-" @@ -2430,7 +3051,10 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -2439,15 +3063,24 @@ "args": [ { "args": [ - "0", - "src" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "src", + { + "type": "int", + "var": "src" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -2461,15 +3094,24 @@ "args": [ { "args": [ - "0", - "dst" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "dst", + { + "type": "int", + "var": "dst" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -2483,15 +3125,24 @@ "args": [ { "args": [ - "0", - "amount" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "amount", + { + "type": "int", + "var": "amount" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -2505,26 +3156,30 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -2533,24 +3188,25 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -2565,30 +3221,38 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -2597,28 +3261,33 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -2633,26 +3302,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -2661,24 +3337,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -2693,26 +3373,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -2721,24 +3408,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -2753,7 +3444,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Caller" ], "arity": 2, @@ -2775,7 +3469,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -2795,83 +3492,99 @@ } ], "returns": { - "expression": "1", - "sort": "int" + "expression": { + "literal": "1", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" }, "stateUpdates": [ { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" } } }, { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" + "type": "int" }, "value": { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "-" @@ -2879,48 +3592,58 @@ } }, { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" }, "value": { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "-" @@ -2928,48 +3651,58 @@ } }, { - "Rewrite": { + "rewrite": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" }, "value": { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "+" @@ -2982,41 +3715,71 @@ "case": [ { "args": [ - "src", - "dst" + { + "type": "int", + "var": "src" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "==" } ], "contract": "Token", - "interface": "transferFrom(address src, address dst, uint256 amount)", + "interface": { + "args": [ + { + "abitype": "address", + "id": "\"src\"", + "kind": "Declaration" + }, + { + "abitype": "address", + "id": "\"dst\"", + "kind": "Declaration" + }, + { + "abitype": "uint256", + "id": "\"amount\"", + "kind": "Declaration" + } + ], + "id": "\"transferFrom\"", + "kind": "Interface" + }, "kind": "Behaviour", "name": "transferFrom", "postConditions": [], "preConditions": [ { "args": [ - "amount", { - "Pre": { + "type": "int", + "var": "amount" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -3026,8 +3789,14 @@ "args": [ { "args": [ - "src", - "dst" + { + "type": "int", + "var": "src" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "=/=" @@ -3037,34 +3806,47 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "+" }, { "args": [ - "2", - "256" + { + "literal": "2", + "type": "int" + }, + { + "literal": "256", + "type": "int" + } ], "arity": 2, "symbol": "^" @@ -3082,41 +3864,55 @@ { "args": [ "Caller", - "src" + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "=/=" }, { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "amount" + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "-" @@ -3132,7 +3928,10 @@ { "args": [ "Callvalue", - "0" + { + "literal": "0", + "type": "int" + } ], "arity": 2, "symbol": "==" @@ -3141,15 +3940,24 @@ "args": [ { "args": [ - "0", - "src" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "src" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "src", + { + "type": "int", + "var": "src" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -3163,15 +3971,24 @@ "args": [ { "args": [ - "0", - "dst" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "dst" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "dst", + { + "type": "int", + "var": "dst" + }, "1461501637330902918203684832716283019655932542975" ], "arity": 2, @@ -3185,15 +4002,24 @@ "args": [ { "args": [ - "0", - "amount" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "amount" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "amount", + { + "type": "int", + "var": "amount" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -3207,26 +4033,30 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -3235,24 +4065,25 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -3267,30 +4098,38 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -3299,28 +4138,33 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -3335,26 +4179,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -3363,24 +4214,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -3395,26 +4250,33 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -3423,24 +4285,28 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -3455,7 +4321,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Caller" ], "arity": 2, @@ -3477,7 +4346,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Callvalue" ], "arity": 2, @@ -3497,99 +4369,113 @@ } ], "returns": { - "expression": "1", - "sort": "int" + "expression": { + "literal": "1", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" }, "stateUpdates": [ { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" } } }, { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.allowance" - }, - [ - { - "expression": "src", - "sort": "int" + "expression": { + "type": "int", + "var": "src" }, - { - "expression": "Caller", - "sort": "int" - } - ] + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "sort": "int" + "type": "int" } } }, { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "src", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" } } }, { - "Constant": { + "constant": { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "dst", - "sort": "int" - } - ] + "expression": { + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" } } } @@ -3602,53 +4488,96 @@ { "location": { "item": { - "var": "Token.name" + "contract": "Token", + "kind": "SVar", + "svar": "name" }, - "sort": "bytestring" + "type": "bytestring" }, - "value": "_name" + "value": { + "type": "bytestring", + "var": "_name" + } }, { "location": { "item": { - "var": "Token.symbol" + "contract": "Token", + "kind": "SVar", + "svar": "symbol" }, - "sort": "bytestring" + "type": "bytestring" }, - "value": "_symbol" + "value": { + "type": "bytestring", + "var": "_symbol" + } }, { "location": { "item": { - "var": "Token.totalSupply" + "contract": "Token", + "kind": "SVar", + "svar": "totalSupply" }, - "sort": "int" + "type": "int" }, - "value": "_totalSupply" + "value": { + "type": "int", + "var": "_totalSupply" + } }, { "location": { "item": { - "args": [ + "indexes": [ { - "var": "Token.balanceOf" - }, - [ - { - "expression": "Caller", - "sort": "int" - } - ] + "expression": "Caller", + "kind": "TypedExpr", + "type": "int" + } ], - "arity": 2, - "symbol": "lookup" + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "sort": "int" + "type": "int" }, - "value": "_totalSupply" + "value": { + "type": "int", + "var": "_totalSupply" + } } ], - "interface": "Token(string _symbol, string _name, string _version, uint256 _totalSupply)", + "interface": { + "args": [ + { + "abitype": "string", + "id": "\"_symbol\"", + "kind": "Declaration" + }, + { + "abitype": "string", + "id": "\"_name\"", + "kind": "Declaration" + }, + { + "abitype": "string", + "id": "\"_version\"", + "kind": "Declaration" + }, + { + "abitype": "uint256", + "id": "\"_totalSupply\"", + "kind": "Declaration" + } + ], + "id": "\"Token\"", + "kind": "Interface" + }, "invariants": [ { "contract": "Token", @@ -3658,15 +4587,24 @@ "args": [ { "args": [ - "0", - "_totalSupply" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "_totalSupply" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "_totalSupply", + { + "type": "int", + "var": "_totalSupply" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -3681,14 +4619,20 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "var": "Token.totalSupply" + "contract": "Token", + "kind": "SVar", + "svar": "totalSupply" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, - "_totalSupply" + { + "type": "int", + "var": "_totalSupply" + } ], "arity": 2, "symbol": "==" @@ -3696,14 +4640,20 @@ { "args": [ { - "Post": { + "entry": { "item": { - "var": "Token.totalSupply" + "contract": "Token", + "kind": "SVar", + "svar": "totalSupply" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Post" }, - "_totalSupply" + { + "type": "int", + "var": "_totalSupply" + } ], "arity": 2, "symbol": "==" @@ -3714,14 +4664,20 @@ "args": [ { "args": [ - "0", { - "Pre": { + "literal": "0", + "type": "int" + }, + { + "entry": { "item": { - "var": "Token.totalSupply" + "contract": "Token", + "kind": "SVar", + "svar": "totalSupply" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" } ], "arity": 2, @@ -3730,12 +4686,15 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "var": "Token.totalSupply" + "contract": "Token", + "kind": "SVar", + "svar": "totalSupply" }, - "sort": "int" - } + "type": "int" + }, + "timing": "Pre" }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], @@ -3756,15 +4715,24 @@ "args": [ { "args": [ - "0", - "_totalSupply" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "_totalSupply" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "_totalSupply", + { + "type": "int", + "var": "_totalSupply" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -3779,14 +4747,20 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "var": "Token.name" + "contract": "Token", + "kind": "SVar", + "svar": "name" }, - "sort": "bytestring" - } + "type": "bytestring" + }, + "timing": "Pre" }, - "_name" + { + "type": "bytestring", + "var": "_name" + } ], "arity": 2, "symbol": "==" @@ -3794,14 +4768,20 @@ { "args": [ { - "Post": { + "entry": { "item": { - "var": "Token.name" + "contract": "Token", + "kind": "SVar", + "svar": "name" }, - "sort": "bytestring" - } + "type": "bytestring" + }, + "timing": "Post" }, - "_name" + { + "type": "bytestring", + "var": "_name" + } ], "arity": 2, "symbol": "==" @@ -3817,15 +4797,24 @@ "args": [ { "args": [ - "0", - "_totalSupply" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "_totalSupply" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "_totalSupply", + { + "type": "int", + "var": "_totalSupply" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -3840,14 +4829,20 @@ { "args": [ { - "Pre": { + "entry": { "item": { - "var": "Token.symbol" + "contract": "Token", + "kind": "SVar", + "svar": "symbol" }, - "sort": "bytestring" - } + "type": "bytestring" + }, + "timing": "Pre" }, - "_symbol" + { + "type": "bytestring", + "var": "_symbol" + } ], "arity": 2, "symbol": "==" @@ -3855,14 +4850,20 @@ { "args": [ { - "Post": { + "entry": { "item": { - "var": "Token.symbol" + "contract": "Token", + "kind": "SVar", + "svar": "symbol" }, - "sort": "bytestring" - } + "type": "bytestring" + }, + "timing": "Post" }, - "_symbol" + { + "type": "bytestring", + "var": "_symbol" + } ], "arity": 2, "symbol": "==" @@ -3878,15 +4879,24 @@ "args": [ { "args": [ - "0", - "_totalSupply" + { + "literal": "0", + "type": "int" + }, + { + "type": "int", + "var": "_totalSupply" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "_totalSupply", + { + "type": "int", + "var": "_totalSupply" + }, "115792089237316195423570985008687907853269984665640564039457584007913129639935" ], "arity": 2, @@ -3900,7 +4910,10 @@ "args": [ { "args": [ - "0", + { + "literal": "0", + "type": "int" + }, "Caller" ], "arity": 2, @@ -3923,42 +4936,93 @@ "kind": "Contract" } ], - "kind": "Program", + "kind": "Act", "store": { "kind": "Storages", "storages": { "Token": { "allowance": [ { - "ixTypes": "[address,address]", - "type": "mapping", - "valType": "uint256" + "ixTypes": [ + { + "abiType": { + "type": "Address" + }, + "kind": "AbiType" + }, + { + "abiType": { + "type": "Address" + }, + "kind": "AbiType" + } + ], + "kind": "MappingType", + "resType": { + "abiType": { + "size": "256", + "type": "UInt" + }, + "kind": "AbiType" + } }, 4 ], "balanceOf": [ { - "ixTypes": "[address]", - "type": "mapping", - "valType": "uint256" + "ixTypes": [ + { + "abiType": { + "type": "Address" + }, + "kind": "AbiType" + } + ], + "kind": "MappingType", + "resType": { + "abiType": { + "size": "256", + "type": "UInt" + }, + "kind": "AbiType" + } }, 3 ], "name": [ { - "type": "string" + "kind": "ValueType", + "valueType": { + "abiType": { + "type": "String" + }, + "kind": "AbiType" + } }, 0 ], "symbol": [ { - "type": "string" + "kind": "ValueType", + "valueType": { + "abiType": { + "type": "String" + }, + "kind": "AbiType" + } }, 1 ], "totalSupply": [ { - "type": "uint256" + "kind": "ValueType", + "valueType": { + "abiType": { + "size": "256", + "type": "UInt" + }, + "kind": "AbiType" + } }, 2 ] From 05f43516b6e5c3ebdef54506e7c85c793f6cb9b6 Mon Sep 17 00:00:00 2001 From: Zoe Paraskevopoulou Date: Tue, 24 Oct 2023 15:48:24 +0300 Subject: [PATCH 3/5] Type error fixes from most recent version of hevm (#165) * HEVM: pretty calldata decoding * smt: add type signature * hevm dump * CLI: fix solc function * Lex: add qualifier --------- Co-authored-by: dxo --- flake.lock | 54 +++++++++++++++++++++++++++++++++++------------------ src/CLI.hs | 6 +++--- src/HEVM.hs | 43 +++++++++++++++++++++++++----------------- src/Lex.x | 6 +++--- src/SMT.hs | 1 + 5 files changed, 69 insertions(+), 41 deletions(-) diff --git a/flake.lock b/flake.lock index 41838511..774f1174 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "cabal-head": { "flake": false, "locked": { - "lastModified": 1691811891, - "narHash": "sha256-e/dXo93pNSva1aKDpuO392Nig1M51Us96Qm0Peb/3bQ=", + "lastModified": 1693777827, + "narHash": "sha256-zMwVwTztoQGrNIJSxSdVJjYN77rleRjpC+K5AoIl7po=", "owner": "haskell", "repo": "cabal", - "rev": "e77f13945d66fb829525c7249d97a6ad29fc701b", + "rev": "24a4603eebfcf7730f00bb69a02d1568990798d5", "type": "github" }, "original": { @@ -54,11 +54,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "type": "github" }, "original": { @@ -68,12 +68,15 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", "type": "github" }, "original": { @@ -103,11 +106,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1677921223, - "narHash": "sha256-TsrPW+VfLu19dYm4uuAaM9LLHm30iZiyW1+0mbFgwbk=", + "lastModified": 1691140388, + "narHash": "sha256-AH3fx2VFGPRSOjnuakab4T4AdUstwTnFTbnkoU4df8Q=", "owner": "shazow", "repo": "foundry.nix", - "rev": "79df1481c10789570c40749a4c8f8aada16f2eea", + "rev": "6089aad0ef615ac8c7b0c948d6052fa848c99523", "type": "github" }, "original": { @@ -130,11 +133,11 @@ "solidity": "solidity" }, "locked": { - "lastModified": 1695059034, - "narHash": "sha256-LqQBLQ5Pl2xDUKqiiRF1iGRWFxTlgrf4SemusvxsnBM=", + "lastModified": 1697630766, + "narHash": "sha256-mIjEe8hBILwGCiBX9eD7eQcpu364BTNSMA0fCSqF2ao=", "owner": "ethereum", "repo": "hevm", - "rev": "fb7c953cc108f7b2350d1e8ab7212dcf38f309f2", + "rev": "3a52ccf6571106ce80f5528a9a0bc3ed2af26681", "type": "github" }, "original": { @@ -159,11 +162,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1684164265, - "narHash": "sha256-ZqNSKSQM12040taiRvSgqwUCPlN1qZAw6nYniYuY1hs=", + "lastModified": 1697718011, + "narHash": "sha256-B72Ah61jRrtVKBgMgxcD9cyx9ApLuzEGQO7GoSpE8qc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "872c89e5a754a04058b4531e54897db5ca734100", + "rev": "ef6f366a9585853405a88e52c933df81d0396e65", "type": "github" }, "original": { @@ -210,6 +213,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/src/CLI.hs b/src/CLI.hs index b9c29702..d4a56e9f 100644 --- a/src/CLI.hs +++ b/src/CLI.hs @@ -238,10 +238,10 @@ hevm actspec cid sol' code' initcode' solver' timeout debug' = do bytecodes :: Text -> Text -> IO (BS.ByteString, BS.ByteString) bytecodes cid src = do - (json, path) <- solidity' src + json <- solc Solidity src let (Contracts sol', _, _) = fromJust $ readStdJSON json - pure $ ((fromJust . Map.lookup (path <> ":" <> cid) $ sol').creationCode, - (fromJust . Map.lookup (path <> ":" <> cid) $ sol').runtimeCode) + pure $ ((fromJust . Map.lookup ("hevm.sol" <> ":" <> cid) $ sol').creationCode, + (fromJust . Map.lookup ("hevm.sol" <> ":" <> cid) $ sol').runtimeCode) diff --git a/src/HEVM.hs b/src/HEVM.hs index 11ec795d..d4f8509c 100644 --- a/src/HEVM.hs +++ b/src/HEVM.hs @@ -35,7 +35,8 @@ import Syntax.Annotated import Syntax.Untyped (makeIface) import Syntax -import qualified EVM.Types as EVM hiding (Contract(..)) +import EVM.ABI (Sig(..)) +import qualified EVM.Types as EVM hiding (Contract(..), FrameState(..)) import EVM.Expr hiding (op2, inRange) import EVM.SymExec hiding (EquivResult, isPartial) import qualified EVM.SymExec as SymExec (EquivResult) @@ -114,19 +115,19 @@ combineFragments' fragments start base = go (EVM.Lit start) fragments (base, []) -- * Act translation -translateActBehvs :: Act -> BS.ByteString -> [(Id, [EVM.Expr EVM.End], Calldata)] +translateActBehvs :: Act -> BS.ByteString -> [(Id, [EVM.Expr EVM.End], Calldata, Sig)] translateActBehvs (Act store contracts) bytecode = let slots = slotMap store in concatMap (\(Contract _ behvs) -> translateBehvs slots bytecode behvs) contracts -translateActConstr :: Act -> BS.ByteString -> (Id, [EVM.Expr EVM.End], Calldata) +translateActConstr :: Act -> BS.ByteString -> (Id, [EVM.Expr EVM.End], Calldata, Sig) translateActConstr (Act store [Contract ctor _]) bytecode = translateConstructor (slotMap store) ctor bytecode translateActConstr (Act _ _) _ = error "TODO multiple contracts" -translateConstructor :: Layout -> Constructor -> BS.ByteString -> (Id, [EVM.Expr EVM.End], Calldata) +translateConstructor :: Layout -> Constructor -> BS.ByteString -> (Id, [EVM.Expr EVM.End], Calldata, Sig) translateConstructor layout (Constructor cid iface preconds _ _ upds _) bytecode = (cid, [EVM.Success (snd calldata <> (fmap (toProp layout) $ preconds)) mempty (EVM.ConcreteBuf bytecode) (updatesToExpr layout cid upds initmap)], - calldata) + calldata, ifaceToSig iface) where calldata = makeCtrCalldata iface initcontract = EVM.C { EVM.code = EVM.RuntimeCode (EVM.ConcreteRuntimeCode bytecode) @@ -136,15 +137,18 @@ translateConstructor layout (Constructor cid iface preconds _ _ upds _) bytecode } initmap = M.fromList [(initAddr, initcontract)] -translateBehvs :: Layout -> BS.ByteString -> [Behaviour] -> [(Id, [EVM.Expr EVM.End], Calldata)] +translateBehvs :: Layout -> BS.ByteString -> [Behaviour] -> [(Id, [EVM.Expr EVM.End], Calldata, Sig)] translateBehvs layout bytecode behvs = let groups = (groupBy sameIface behvs) :: [[Behaviour]] in - fmap (\behvs' -> (behvName behvs', fmap (translateBehv layout bytecode) behvs', behvCalldata behvs')) groups + fmap (\behvs' -> (behvName behvs', fmap (translateBehv layout bytecode) behvs', behvCalldata behvs', behvSig behvs)) groups where behvCalldata (Behaviour _ _ iface _ _ _ _ _:_) = makeCalldata iface behvCalldata [] = error "Internal error: behaviour groups cannot be empty" + behvSig (Behaviour _ _ iface _ _ _ _ _:_) = ifaceToSig iface + behvSig [] = error "Internal error: behaviour groups cannot be empty" + -- TODO remove reduntant name in behaviours sameIface (Behaviour _ _ iface _ _ _ _ _) (Behaviour _ _ iface' _ _ _ _ _) = makeIface iface == makeIface iface' @@ -152,6 +156,11 @@ translateBehvs layout bytecode behvs = behvName (Behaviour _ _ (Interface name _) _ _ _ _ _:_) = name behvName [] = error "Internal error: behaviour groups cannot be empty" +ifaceToSig :: Interface -> Sig +ifaceToSig (Interface name args) = Sig (T.pack name) (fmap fromdecl args) + where + fromdecl (Decl t _) = t + translateBehv :: Layout -> BS.ByteString -> Behaviour -> EVM.Expr EVM.End translateBehv layout bytecode (Behaviour _ cid _ preconds caseconds _ upds ret) = EVM.Success (fmap (toProp layout) $ preconds <> caseconds) mempty (returnsToExpr layout ret) (rewritesToExpr layout cid upds bytecode) @@ -395,15 +404,15 @@ checkEquiv solvers opts l1 l2 = checkConstructors :: SolverGroup -> VeriOpts -> ByteString -> ByteString -> Act -> IO () checkConstructors solvers opts initcode runtimecode act = do - let (_, actbehvs, calldata) = translateActConstr act runtimecode + let (_, actbehvs, calldata, sig) = translateActConstr act runtimecode initVM <- stToIO $ abstractVM calldata initcode Nothing True expr <- interpret (Fetch.oracle solvers Nothing) Nothing 1 StackBased initVM runExpr let simpl = if True then (simplify expr) else expr let solbehvs = removeFails $ flattenExpr simpl putStrLn "\x1b[1mChecking if constructor results are equivalent.\x1b[m" - checkResult =<< checkEquiv solvers opts solbehvs actbehvs + checkResult calldata (Just sig) =<< checkEquiv solvers opts solbehvs actbehvs putStrLn "\x1b[1mChecking if constructor input spaces are the same.\x1b[m" - checkResult =<< checkInputSpaces solvers opts solbehvs actbehvs + checkResult calldata (Just sig) =<< checkInputSpaces solvers opts solbehvs actbehvs where removeFails branches = filter isSuccess $ branches @@ -411,15 +420,15 @@ checkConstructors solvers opts initcode runtimecode act = do checkBehaviours :: SolverGroup -> VeriOpts -> ByteString -> Act -> IO () checkBehaviours solvers opts bytecode act = do let actbehvs = translateActBehvs act bytecode - flip mapM_ actbehvs $ \(name,behvs,calldata) -> do + flip mapM_ actbehvs $ \(name,behvs,calldata,sig) -> do solbehvs <- removeFails <$> getBranches solvers bytecode calldata putStrLn $ "\x1b[1mChecking behavior \x1b[4m" <> name <> "\x1b[m of Act\x1b[m" -- equivalence check putStrLn "\x1b[1mChecking if behaviour is matched by EVM\x1b[m" - checkResult =<< checkEquiv solvers opts solbehvs behvs + checkResult calldata (Just sig) =<< checkEquiv solvers opts solbehvs behvs -- input space exhaustiveness check putStrLn "\x1b[1mChecking if the input spaces are the same\x1b[m" - checkResult =<< checkInputSpaces solvers opts solbehvs behvs + checkResult calldata (Just sig) =<< checkInputSpaces solvers opts solbehvs behvs where removeFails branches = filter isSuccess $ branches @@ -470,7 +479,7 @@ checkAbi solver opts act bytecode = do ("abi-query-" <> show idx <> ".smt2") (formatSMT2 q <> "\n\n(check-sat)") - checkResult =<< fmap (toVRes msg) <$> mapConcurrently (checkSat solver) queries + checkResult (txdata, []) Nothing =<< fmap (toVRes msg) <$> mapConcurrently (checkSat solver) queries where actSig (Behaviour _ _ iface _ _ _ _ _) = T.pack $ makeIface iface @@ -537,8 +546,8 @@ toVRes msg res = case res of Error e -> error $ "Internal Error: solver responded with error: " <> show e -checkResult :: [EquivResult] -> IO () -checkResult res = +checkResult :: Calldata -> Maybe Sig -> [EquivResult] -> IO () +checkResult calldata sig res = case any isCex res of False -> do putStrLn "\x1b[42mNo discrepancies found\x1b[m" @@ -550,5 +559,5 @@ checkResult res = TIO.putStrLn . T.unlines $ [ "\x1b[41mNot equivalent.\x1b[m" , "" , "-----", "" - ] <> (intersperse (T.unlines [ "", "-----" ]) $ fmap (\(msg, cex) -> msg <> "\n" <> formatCex (EVM.AbstractBuf "txdata") cex) cexs) + ] <> (intersperse (T.unlines [ "", "-----" ]) $ fmap (\(msg, cex) -> msg <> "\n" <> formatCex (fst calldata) sig cex) cexs) exitFailure diff --git a/src/Lex.x b/src/Lex.x index e39ba6f4..83e4fa41 100644 --- a/src/Lex.x +++ b/src/Lex.x @@ -98,9 +98,9 @@ tokens :- ")" { mk RPAREN } "[" { mk LBRACK } "]" { mk RBRACK } - "=" { mk EQ } - ">" { mk GT } - "<" { mk LT } + "=" { mk Lex.EQ } + ">" { mk Lex.GT } + "<" { mk Lex.LT } ":" { mk COLON } "+" { mk PLUS } "-" { mk MINUS } diff --git a/src/SMT.hs b/src/SMT.hs index 38ac6e45..fd275b20 100644 --- a/src/SMT.hs +++ b/src/SMT.hs @@ -520,6 +520,7 @@ parseSMTModel s = if length s0Caps == 1 s0Caps = getCaptures s stage0 s1Caps = getCaptures (head s0Caps) stage1 + getCaptures :: String -> String -> [String] getCaptures str regex = captures where (_, _, _, captures) = str =~ regex :: (String, String, String, [String]) From edbabcca3cbf78aa191d88cfa4599e35c256b414 Mon Sep 17 00:00:00 2001 From: Zoe Paraskevopoulou Date: Fri, 27 Oct 2023 13:43:02 +0300 Subject: [PATCH 4/5] JSON nits for `Exp` (#169) * json fixes * test: regenerate test outputs --- src/Syntax/TimeAgnostic.hs | 28 +- tests/frontend/pass/case/case.act.typed.json | 155 +- .../pass/creation/create.act.typed.json | 22 +- .../frontend/pass/multi/multi.act.typed.json | 103 +- .../pass/safemath/safemathraw.act.typed.json | 97 +- .../frontend/pass/smoke/smoke.act.typed.json | 20 +- .../pass/token/transfer.act.typed.json | 1340 +++++++++++++++-- 7 files changed, 1532 insertions(+), 233 deletions(-) diff --git a/src/Syntax/TimeAgnostic.hs b/src/Syntax/TimeAgnostic.hs index 5f7d89bf..7204a001 100644 --- a/src/Syntax/TimeAgnostic.hs +++ b/src/Syntax/TimeAgnostic.hs @@ -383,7 +383,7 @@ instance ToJSON (Constructor Timed) where , "preConditions" .= toJSON _cpreconditions , "postConditions" .= toJSON _cpostconditions , "invariants" .= listValue (\i@Invariant{..} -> invariantJSON i _predicate) _invariants - , "initial storage" .= toJSON _initialStorage ] + , "initialStorage" .= toJSON _initialStorage ] instance ToJSON (Constructor Untimed) where toJSON Constructor{..} = object [ "kind" .= String "Constructor" @@ -414,7 +414,7 @@ instance ToJSON Interface where instance ToJSON Decl where toJSON (Decl abitype x) = object [ "kind" .= String "Declaration" , "id" .= pack (show x) - , "abitype" .= pack (show abitype) + , "abitype" .= toJSON abitype ] @@ -473,14 +473,19 @@ instance ToJSON (Exp a t) where toJSON (Div _ a b) = symbol "/" a b toJSON (LitInt _ a) = object [ "literal" .= pack (show a) , "type" .= pack "int" ] - toJSON (IntMin _ a) = toJSON $ show $ intmin a - toJSON (IntMax _ a) = toJSON $ show $ intmax a - toJSON (UIntMin _ a) = toJSON $ show $ uintmin a - toJSON (UIntMax _ a) = toJSON $ show $ uintmax a + toJSON (IntMin _ a) = object [ "literal" .= pack (show $ intmin a) + , "type" .= pack "int" ] + toJSON (IntMax _ a) = object [ "literal" .= pack (show $ intmax a) + , "type" .= pack "int" ] + toJSON (UIntMin _ a) = object [ "literal" .= pack (show $ uintmin a) + , "type" .= pack "int" ] + toJSON (UIntMax _ a) = object [ "literal" .= pack (show $ uintmax a) + , "type" .= pack "int" ] toJSON (InRange _ a b) = object [ "symbol" .= pack "inrange" , "arity" .= Data.Aeson.Types.Number 2 - , "args" .= Array (fromList [String (pack $ show a), toJSON b]) ] - toJSON (IntEnv _ a) = String $ pack $ show a + , "args" .= Array (fromList [toJSON a, toJSON b]) ] + toJSON (IntEnv _ a) = object [ "ethEnv" .= pack (show a) + , "type" .= pack "int" ] toJSON (ITE _ a b c) = object [ "symbol" .= pack "ite" , "arity" .= Data.Aeson.Types.Number 3 , "args" .= Array (fromList [toJSON a, toJSON b, toJSON c]) ] @@ -509,10 +514,11 @@ instance ToJSON (Exp a t) where , "type" .= pack "bytestring" ] toJSON (ByEnv _ a) = object [ "ethEnv" .= pack (show a) , "type" .= pack "bytestring" ] - toJSON (TEntry _ t a) = object [ "entry" .= toJSON a + toJSON (TEntry _ t a) = object [ "entry" .= toJSON a , "timing" .= show t ] - toJSON (Var _ t _ a) = object [ "var" .= toJSON a - , "type" .= show t ] + toJSON (Var _ t abitype a) = object [ "var" .= toJSON a + , "abitype" .= toJSON abitype + , "type" .= show t ] toJSON (Create _ f xs) = object [ "symbol" .= pack "create" , "arity" .= Data.Aeson.Types.Number 2 , "args" .= Array (fromList [object [ "fun" .= String (pack f) ], toJSON xs]) ] diff --git a/tests/frontend/pass/case/case.act.typed.json b/tests/frontend/pass/case/case.act.typed.json index 0de11f7a..448d4235 100644 --- a/tests/frontend/pass/case/case.act.typed.json +++ b/tests/frontend/pass/case/case.act.typed.json @@ -7,6 +7,10 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, @@ -23,7 +27,10 @@ "interface": { "args": [ { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"z\"", "kind": "Declaration" } @@ -37,7 +44,10 @@ "preConditions": [ { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -55,6 +65,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" } @@ -65,10 +79,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -113,7 +134,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -130,15 +154,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -161,6 +194,10 @@ "type": "int" }, "value": { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" } @@ -173,6 +210,10 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, @@ -189,7 +230,10 @@ "interface": { "args": [ { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"z\"", "kind": "Declaration" } @@ -203,7 +247,10 @@ "preConditions": [ { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -221,6 +268,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" } @@ -231,10 +282,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -279,7 +337,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -296,15 +357,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -329,6 +399,10 @@ "value": { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, @@ -349,6 +423,10 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, @@ -365,7 +443,10 @@ "interface": { "args": [ { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"z\"", "kind": "Declaration" } @@ -379,7 +460,10 @@ "preConditions": [ { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -397,6 +481,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" } @@ -407,10 +495,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -455,7 +550,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -472,15 +570,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -505,6 +612,10 @@ "value": { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, @@ -523,7 +634,7 @@ ], "constructor": { "contract": "C", - "initial storage": [ + "initialStorage": [ { "location": { "item": { diff --git a/tests/frontend/pass/creation/create.act.typed.json b/tests/frontend/pass/creation/create.act.typed.json index 27902efa..77affbc7 100644 --- a/tests/frontend/pass/creation/create.act.typed.json +++ b/tests/frontend/pass/creation/create.act.typed.json @@ -4,7 +4,7 @@ "behaviours": [], "constructor": { "contract": "Modest", - "initial storage": [ + "initialStorage": [ { "location": { "item": { @@ -28,7 +28,10 @@ }, "type": "int" }, - "value": "Caller" + "value": { + "ethEnv": "Caller", + "type": "int" + } } ], "interface": { @@ -48,15 +51,24 @@ "literal": "0", "type": "int" }, - "Caller" + { + "ethEnv": "Caller", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Caller", - "1461501637330902918203684832716283019655932542975" + { + "ethEnv": "Caller", + "type": "int" + }, + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" diff --git a/tests/frontend/pass/multi/multi.act.typed.json b/tests/frontend/pass/multi/multi.act.typed.json index e1ae9788..48f5fef1 100644 --- a/tests/frontend/pass/multi/multi.act.typed.json +++ b/tests/frontend/pass/multi/multi.act.typed.json @@ -4,7 +4,7 @@ "behaviours": [], "constructor": { "contract": "A", - "initial storage": [ + "initialStorage": [ { "location": { "item": { @@ -45,7 +45,10 @@ "interface": { "args": [ { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"z\"", "kind": "Declaration" } @@ -59,7 +62,10 @@ "preConditions": [ { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -77,6 +83,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" } @@ -87,10 +97,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -145,7 +162,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -162,15 +182,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -198,6 +227,10 @@ "type": "int" }, "value": { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" } @@ -216,7 +249,10 @@ "interface": { "args": [ { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"z\"", "kind": "Declaration" } @@ -230,7 +266,10 @@ "preConditions": [ { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -248,6 +287,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" } @@ -258,10 +301,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -306,7 +356,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -361,7 +414,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -378,15 +434,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -430,6 +495,10 @@ "type": "int" }, "value": { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "z" } @@ -440,7 +509,7 @@ ], "constructor": { "contract": "B", - "initial storage": [ + "initialStorage": [ { "location": { "item": { diff --git a/tests/frontend/pass/safemath/safemathraw.act.typed.json b/tests/frontend/pass/safemath/safemathraw.act.typed.json index 97bdcb4b..63b65ed6 100644 --- a/tests/frontend/pass/safemath/safemathraw.act.typed.json +++ b/tests/frontend/pass/safemath/safemathraw.act.typed.json @@ -13,12 +13,18 @@ "interface": { "args": [ { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"x\"", "kind": "Declaration" }, { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"y\"", "kind": "Declaration" } @@ -32,14 +38,25 @@ "preConditions": [ { "args": [ - "uint256", + { + "size": "256", + "type": "UInt" + }, { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "x" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "y" } @@ -53,8 +70,15 @@ }, { "args": [ - "uint256", { + "size": "256", + "type": "UInt" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "x" } @@ -64,8 +88,15 @@ }, { "args": [ - "uint256", { + "size": "256", + "type": "UInt" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "y" } @@ -75,7 +106,10 @@ }, { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -93,6 +127,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "x" } @@ -103,10 +141,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "x" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -124,6 +169,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "y" } @@ -134,10 +183,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "y" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -154,15 +210,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -176,10 +241,18 @@ "expression": { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "x" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "y" } @@ -195,7 +268,7 @@ ], "constructor": { "contract": "SafeAdd", - "initial storage": [], + "initialStorage": [], "interface": { "args": [], "id": "\"SafeAdd\"", diff --git a/tests/frontend/pass/smoke/smoke.act.typed.json b/tests/frontend/pass/smoke/smoke.act.typed.json index bf4aaad5..2bc7f9c5 100644 --- a/tests/frontend/pass/smoke/smoke.act.typed.json +++ b/tests/frontend/pass/smoke/smoke.act.typed.json @@ -13,7 +13,10 @@ "interface": { "args": [ { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"x\"", "kind": "Declaration" } @@ -34,6 +37,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "x" } @@ -44,10 +51,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "x" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -70,7 +84,7 @@ ], "constructor": { "contract": "A", - "initial storage": [], + "initialStorage": [], "interface": { "args": [], "id": "\"A\"", diff --git a/tests/frontend/pass/token/transfer.act.typed.json b/tests/frontend/pass/token/transfer.act.typed.json index e44696c2..7e5582c4 100644 --- a/tests/frontend/pass/token/transfer.act.typed.json +++ b/tests/frontend/pass/token/transfer.act.typed.json @@ -6,8 +6,14 @@ "case": [ { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" } @@ -20,12 +26,17 @@ "interface": { "args": [ { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"value\"", "kind": "Declaration" }, { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"to\"", "kind": "Declaration" } @@ -39,7 +50,10 @@ "preConditions": [ { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -51,6 +65,10 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" }, @@ -59,7 +77,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -83,8 +104,14 @@ "args": [ { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" } @@ -102,6 +129,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, @@ -121,6 +151,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" } @@ -159,6 +193,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" } @@ -169,10 +207,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -190,6 +235,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" } @@ -200,10 +248,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -225,7 +279,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -252,7 +309,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -268,7 +328,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -291,6 +354,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, @@ -321,6 +387,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, @@ -339,7 +408,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -356,15 +428,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -381,15 +462,24 @@ "literal": "0", "type": "int" }, - "Caller" + { + "ethEnv": "Caller", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Caller", - "1461501637330902918203684832716283019655932542975" + { + "ethEnv": "Caller", + "type": "int" + }, + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -414,7 +504,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -435,7 +528,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -452,6 +548,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" } @@ -468,6 +568,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, @@ -492,6 +595,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, @@ -511,6 +617,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" } @@ -526,8 +636,14 @@ "case": [ { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" } @@ -540,12 +656,17 @@ "interface": { "args": [ { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"value\"", "kind": "Declaration" }, { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"to\"", "kind": "Declaration" } @@ -559,7 +680,10 @@ "preConditions": [ { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -571,6 +695,10 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" }, @@ -579,7 +707,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -603,8 +734,14 @@ "args": [ { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" } @@ -622,6 +759,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, @@ -641,6 +781,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" } @@ -679,6 +823,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" } @@ -689,10 +837,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "value" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -710,6 +865,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" } @@ -720,10 +878,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -745,7 +909,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -772,7 +939,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -788,7 +958,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -811,6 +984,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, @@ -841,6 +1017,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, @@ -859,7 +1038,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -876,15 +1058,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -901,15 +1092,24 @@ "literal": "0", "type": "int" }, - "Caller" + { + "ethEnv": "Caller", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Caller", - "1461501637330902918203684832716283019655932542975" + { + "ethEnv": "Caller", + "type": "int" + }, + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -934,7 +1134,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -957,6 +1160,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "to" }, @@ -984,10 +1190,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -997,8 +1209,14 @@ }, { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -1015,17 +1233,24 @@ "interface": { "args": [ { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"src\"", "kind": "Declaration" }, { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"dst\"", "kind": "Declaration" }, { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"amount\"", "kind": "Declaration" } @@ -1040,6 +1265,10 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" }, @@ -1048,7 +1277,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1073,10 +1305,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -1094,6 +1332,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -1113,6 +1354,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -1146,8 +1391,14 @@ "args": [ { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -1169,6 +1420,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -1176,7 +1430,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1193,6 +1450,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -1210,7 +1471,10 @@ }, { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -1228,6 +1492,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -1238,10 +1505,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -1259,6 +1532,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -1269,10 +1545,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -1290,6 +1572,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -1300,10 +1586,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -1325,7 +1618,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1352,7 +1648,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1368,7 +1667,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -1391,6 +1693,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -1398,7 +1703,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1426,6 +1734,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -1433,7 +1744,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1449,7 +1763,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -1472,6 +1789,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -1502,6 +1822,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -1520,7 +1843,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -1543,6 +1869,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -1573,6 +1902,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -1591,7 +1923,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -1608,15 +1943,24 @@ "literal": "0", "type": "int" }, - "Caller" + { + "ethEnv": "Caller", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Caller", - "1461501637330902918203684832716283019655932542975" + { + "ethEnv": "Caller", + "type": "int" + }, + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -1633,15 +1977,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -1666,7 +2019,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1689,6 +2045,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -1696,7 +2055,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1719,6 +2081,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -1743,6 +2108,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -1762,6 +2130,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -1778,6 +2150,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -1802,6 +2177,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -1821,6 +2199,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -1841,10 +2223,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -1854,8 +2242,14 @@ }, { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -1875,6 +2269,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -1882,7 +2279,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1935,17 +2335,24 @@ "interface": { "args": [ { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"src\"", "kind": "Declaration" }, { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"dst\"", "kind": "Declaration" }, { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"amount\"", "kind": "Declaration" } @@ -1960,6 +2367,10 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" }, @@ -1968,7 +2379,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -1993,10 +2407,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -2014,6 +2434,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -2033,6 +2456,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -2066,8 +2493,14 @@ "args": [ { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -2089,6 +2522,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -2096,7 +2532,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -2113,6 +2552,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -2130,7 +2573,10 @@ }, { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -2148,6 +2594,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -2158,10 +2607,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -2179,6 +2634,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -2189,10 +2647,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -2210,6 +2674,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -2220,10 +2688,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -2245,7 +2720,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -2272,7 +2750,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -2288,7 +2769,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -2311,6 +2795,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -2318,7 +2805,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -2346,6 +2836,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -2353,7 +2846,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -2369,7 +2865,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -2392,6 +2891,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -2422,6 +2924,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -2440,7 +2945,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -2463,6 +2971,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -2493,6 +3004,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -2511,7 +3025,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -2528,15 +3045,24 @@ "literal": "0", "type": "int" }, - "Caller" + { + "ethEnv": "Caller", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Caller", - "1461501637330902918203684832716283019655932542975" + { + "ethEnv": "Caller", + "type": "int" + }, + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -2553,15 +3079,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -2586,7 +3121,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -2609,6 +3147,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -2616,7 +3157,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -2639,6 +3183,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -2663,6 +3210,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -2682,6 +3232,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -2698,6 +3252,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -2722,6 +3279,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -2741,6 +3301,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -2761,10 +3325,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -2774,8 +3344,14 @@ }, { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -2795,6 +3371,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -2802,7 +3381,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -2855,17 +3437,24 @@ "interface": { "args": [ { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"src\"", "kind": "Declaration" }, { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"dst\"", "kind": "Declaration" }, { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"amount\"", "kind": "Declaration" } @@ -2880,6 +3469,10 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" }, @@ -2888,7 +3481,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -2913,10 +3509,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -2934,6 +3536,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -2953,6 +3558,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -2986,8 +3595,14 @@ "args": [ { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -3009,6 +3624,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3016,7 +3634,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3033,6 +3654,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -3050,7 +3675,10 @@ }, { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -3068,6 +3696,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -3078,10 +3709,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3099,6 +3736,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -3109,10 +3749,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3130,6 +3776,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -3140,10 +3790,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3165,7 +3822,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3192,7 +3852,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3208,7 +3871,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3231,6 +3897,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3238,7 +3907,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3266,6 +3938,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3273,7 +3948,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3289,7 +3967,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3312,6 +3993,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3342,6 +4026,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3360,7 +4047,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3383,6 +4073,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -3413,6 +4106,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -3431,7 +4127,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3448,15 +4147,24 @@ "literal": "0", "type": "int" }, - "Caller" + { + "ethEnv": "Caller", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Caller", - "1461501637330902918203684832716283019655932542975" + { + "ethEnv": "Caller", + "type": "int" + }, + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3473,15 +4181,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3506,7 +4223,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3529,6 +4249,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3536,7 +4259,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3558,6 +4284,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3565,7 +4294,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3582,6 +4314,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -3598,6 +4334,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3622,6 +4361,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3641,6 +4383,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -3657,6 +4403,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -3681,6 +4430,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -3700,6 +4452,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -3716,10 +4472,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -3732,17 +4494,24 @@ "interface": { "args": [ { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"src\"", "kind": "Declaration" }, { - "abitype": "address", + "abitype": { + "type": "Address" + }, "id": "\"dst\"", "kind": "Declaration" }, { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"amount\"", "kind": "Declaration" } @@ -3757,6 +4526,10 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" }, @@ -3765,7 +4538,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3790,10 +4566,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -3811,6 +4593,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -3830,6 +4615,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -3863,8 +4652,14 @@ "args": [ { "args": [ - "Caller", { + "ethEnv": "Caller", + "type": "int" + }, + { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -3886,6 +4681,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -3893,7 +4691,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -3910,6 +4711,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -3927,7 +4732,10 @@ }, { "args": [ - "Callvalue", + { + "ethEnv": "Callvalue", + "type": "int" + }, { "literal": "0", "type": "int" @@ -3945,6 +4753,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" } @@ -3955,10 +4766,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -3976,6 +4793,9 @@ "type": "int" }, { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" } @@ -3986,10 +4806,16 @@ { "args": [ { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, - "1461501637330902918203684832716283019655932542975" + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4007,6 +4833,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" } @@ -4017,10 +4847,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "amount" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4042,7 +4879,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -4069,7 +4909,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -4085,7 +4928,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4108,6 +4954,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -4115,7 +4964,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -4143,6 +4995,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -4150,7 +5005,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -4166,7 +5024,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4189,6 +5050,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -4219,6 +5083,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -4237,7 +5104,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4260,6 +5130,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -4290,6 +5163,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -4308,7 +5184,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4325,15 +5204,24 @@ "literal": "0", "type": "int" }, - "Caller" + { + "ethEnv": "Caller", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Caller", - "1461501637330902918203684832716283019655932542975" + { + "ethEnv": "Caller", + "type": "int" + }, + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4350,15 +5238,24 @@ "literal": "0", "type": "int" }, - "Callvalue" + { + "ethEnv": "Callvalue", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Callvalue", - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "ethEnv": "Callvalue", + "type": "int" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4383,7 +5280,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -4406,6 +5306,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -4413,7 +5316,10 @@ "type": "int" }, { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -4436,6 +5342,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "src" }, @@ -4461,6 +5370,9 @@ "indexes": [ { "expression": { + "abitype": { + "type": "Address" + }, "type": "int", "var": "dst" }, @@ -4484,7 +5396,7 @@ ], "constructor": { "contract": "Token", - "initial storage": [ + "initialStorage": [ { "location": { "item": { @@ -4495,6 +5407,9 @@ "type": "bytestring" }, "value": { + "abitype": { + "type": "String" + }, "type": "bytestring", "var": "_name" } @@ -4509,6 +5424,9 @@ "type": "bytestring" }, "value": { + "abitype": { + "type": "String" + }, "type": "bytestring", "var": "_symbol" } @@ -4523,6 +5441,10 @@ "type": "int" }, "value": { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" } @@ -4532,7 +5454,10 @@ "item": { "indexes": [ { - "expression": "Caller", + "expression": { + "ethEnv": "Caller", + "type": "int" + }, "kind": "TypedExpr", "type": "int" } @@ -4547,6 +5472,10 @@ "type": "int" }, "value": { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" } @@ -4555,22 +5484,31 @@ "interface": { "args": [ { - "abitype": "string", + "abitype": { + "type": "String" + }, "id": "\"_symbol\"", "kind": "Declaration" }, { - "abitype": "string", + "abitype": { + "type": "String" + }, "id": "\"_name\"", "kind": "Declaration" }, { - "abitype": "string", + "abitype": { + "type": "String" + }, "id": "\"_version\"", "kind": "Declaration" }, { - "abitype": "uint256", + "abitype": { + "size": "256", + "type": "UInt" + }, "id": "\"_totalSupply\"", "kind": "Declaration" } @@ -4592,6 +5530,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" } @@ -4602,10 +5544,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4630,6 +5579,10 @@ "timing": "Pre" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" } @@ -4651,6 +5604,10 @@ "timing": "Post" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" } @@ -4696,7 +5653,10 @@ }, "timing": "Pre" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4720,6 +5680,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" } @@ -4730,10 +5694,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4758,6 +5729,9 @@ "timing": "Pre" }, { + "abitype": { + "type": "String" + }, "type": "bytestring", "var": "_name" } @@ -4779,6 +5753,9 @@ "timing": "Post" }, { + "abitype": { + "type": "String" + }, "type": "bytestring", "var": "_name" } @@ -4802,6 +5779,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" } @@ -4812,10 +5793,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4840,6 +5828,9 @@ "timing": "Pre" }, { + "abitype": { + "type": "String" + }, "type": "bytestring", "var": "_symbol" } @@ -4861,6 +5852,9 @@ "timing": "Post" }, { + "abitype": { + "type": "String" + }, "type": "bytestring", "var": "_symbol" } @@ -4884,6 +5878,10 @@ "type": "int" }, { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" } @@ -4894,10 +5892,17 @@ { "args": [ { + "abitype": { + "size": "256", + "type": "UInt" + }, "type": "int", "var": "_totalSupply" }, - "115792089237316195423570985008687907853269984665640564039457584007913129639935" + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } ], "arity": 2, "symbol": "<=" @@ -4914,15 +5919,24 @@ "literal": "0", "type": "int" }, - "Caller" + { + "ethEnv": "Caller", + "type": "int" + } ], "arity": 2, "symbol": "<=" }, { "args": [ - "Caller", - "1461501637330902918203684832716283019655932542975" + { + "ethEnv": "Caller", + "type": "int" + }, + { + "literal": "1461501637330902918203684832716283019655932542975", + "type": "int" + } ], "arity": 2, "symbol": "<=" From 3d8ad0b1ddce80f866d270ebcd12433af07e610b Mon Sep 17 00:00:00 2001 From: Zoe Paraskevopoulou Date: Wed, 8 Nov 2023 19:45:59 +0200 Subject: [PATCH 5/5] Act cleanup (#170) * syntax: remove constant from untyped AST * Syntax: remove constant * tests: regenerate test outputs * enrich: generate contraints for variables in preconditions and cases * test: regenerate test outputs * enrich: fix storage var timings * enrich: fix in constructor * smt: wip trying to fix undeclared storage vars * SMT: declare all mentioned vars * enrich: only add bounds for pre * test: remove constant * test: remove constant * test: fix compilation error --- src/Coq.hs | 6 +- src/Enrich.hs | 35 +- src/HEVM.hs | 11 +- src/K.hs | 313 --- src/Parse.y | 1 - src/Print.hs | 5 +- src/SMT.hs | 51 +- src/Syntax.hs | 77 +- src/Syntax/Annotated.hs | 10 +- src/Syntax/TimeAgnostic.hs | 12 +- src/Syntax/Typed.hs | 5 +- src/Syntax/Untyped.hs | 1 - src/Type.hs | 20 +- src/act.cabal | 2 +- src/test/Test.hs | 2 +- tests/coq/ERC20/erc20.act | 17 - tests/coq/exponent/exponent.act | 3 +- tests/frontend/pass/case/case.act.typed.json | 126 +- .../frontend/pass/multi/multi.act.typed.json | 102 +- .../frontend/pass/staticstore/staticstore.act | 5 - .../staticstore/staticstore.act.parsed.hs | 2 +- tests/frontend/pass/token/transfer.act | 16 - .../pass/token/transfer.act.parsed.hs | 2 +- .../pass/token/transfer.act.typed.json | 2333 +++++++++-------- 24 files changed, 1503 insertions(+), 1654 deletions(-) delete mode 100644 src/K.hs diff --git a/src/Coq.hs b/src/Coq.hs index 95520a4e..42d7ae73 100644 --- a/src/Coq.hs +++ b/src/Coq.hs @@ -77,7 +77,7 @@ reachable constructor behvs = inductive -- | non-recursive constructor for the reachable relation baseCase :: Constructor -> T.Text -baseCase (Constructor name i@(Interface _ decls) conds _ _ _ _) = +baseCase (Constructor name i@(Interface _ decls) conds _ _ _ ) = T.pack name <> baseSuffix <> " : " <> universal <> "\n" <> constructorBody where baseval = parens $ T.pack name <> " " <> envVar <> " " <> arguments i @@ -113,7 +113,7 @@ reachableStep (Behaviour name _ i conds cases _ _ _) = -- | definition of a base state base :: Store -> Constructor -> T.Text -base store (Constructor name i _ _ _ updates _) = +base store (Constructor name i _ _ _ updates) = definition (T.pack name) (envDecl <> " " <> interface i) $ stateval store name (\_ t -> defaultSlotValue t) updates @@ -121,7 +121,7 @@ transition :: Store -> Behaviour -> Fresh T.Text transition store (Behaviour name cname i _ _ _ rewrites _) = do name' <- fresh name return $ definition name' (envDecl <> " " <> stateDecl <> " " <> interface i) $ - stateval store cname (\ref _ -> storageRef ref) (updatesFromRewrites rewrites) + stateval store cname (\ref _ -> storageRef ref) rewrites -- | inductive definition of a return claim -- ignores claims that do not specify a return value diff --git a/src/Enrich.hs b/src/Enrich.hs index 09b9867a..e0f48e00 100644 --- a/src/Enrich.hs +++ b/src/Enrich.hs @@ -18,36 +18,36 @@ enrich (Act store contracts) = Act store (enrichContract <$> contracts) -- |Adds type bounds for calldata , environment vars, and external storage vars as preconditions enrichConstructor :: Constructor -> Constructor -enrichConstructor ctor@(Constructor _ (Interface _ decls) pre _ invs _ storageUpdates) = +enrichConstructor ctor@(Constructor _ (Interface _ decls) pre _ invs _) = ctor { _cpreconditions = pre' , _invariants = invs' } where pre' = pre <> mkCallDataBounds decls - <> mkStorageBounds storageUpdates <> mkEthEnvBounds (ethEnvFromConstructor ctor) invs' = enrichInvariant ctor <$> invs -- | Adds type bounds for calldata, environment vars, and storage vars as preconditions enrichBehaviour :: Behaviour -> Behaviour -enrichBehaviour behv@(Behaviour _ _ (Interface _ decls) pre _ _ stateUpdates _) = +enrichBehaviour behv@(Behaviour _ _ (Interface _ decls) pre cases _ stateUpdates _) = behv { _preconditions = pre' } where pre' = pre <> mkCallDataBounds decls <> mkStorageBounds stateUpdates + <> mkStorageBoundsLoc (concatMap locsFromExp (pre <> cases)) <> mkEthEnvBounds (ethEnvFromBehaviour behv) -- | Adds type bounds for calldata, environment vars, and storage vars enrichInvariant :: Constructor -> Invariant -> Invariant -enrichInvariant (Constructor _ (Interface _ decls) _ _ _ _ _) inv@(Invariant _ preconds storagebounds (predicate,_)) = +enrichInvariant (Constructor _ (Interface _ decls) _ _ _ _) inv@(Invariant _ preconds storagebounds (predicate,_)) = inv { _ipreconditions = preconds', _istoragebounds = storagebounds' } where preconds' = preconds <> mkCallDataBounds decls <> mkEthEnvBounds (ethEnvFromExp predicate) storagebounds' = storagebounds - <> mkStorageBounds (Constant <$> locsFromExp predicate) + <> mkStorageBoundsLoc (locsFromExp predicate) mkEthEnvBounds :: [EthEnv] -> [Exp ABoolean] mkEthEnvBounds vars = catMaybes $ mkBound <$> nub vars @@ -74,17 +74,24 @@ mkEthEnvBounds vars = catMaybes $ mkBound <$> nub vars Nonce -> AbiUIntType 256 -- | extracts bounds from the AbiTypes of Integer values in storage -mkStorageBounds :: [Rewrite] -> [Exp ABoolean] -mkStorageBounds refs = catMaybes $ mkBound <$> refs +mkStorageBounds :: [StorageUpdate] -> [Exp ABoolean] +mkStorageBounds refs = concatMap mkBound refs where - mkBound :: Rewrite -> Maybe (Exp ABoolean) - mkBound (Constant (Loc SInteger item)) = Just $ fromItem item - mkBound (Rewrite (Update SInteger item _)) = Just $ fromItem item - mkBound _ = Nothing + mkBound :: StorageUpdate -> [Exp ABoolean] + mkBound (Update SInteger item _) = [fromItem item] + mkBound _ = [] - fromItem :: TStorageItem AInteger -> Exp ABoolean - fromItem item@(Item _ (PrimitiveType vt) _) = bound vt (TEntry nowhere Pre item) - fromItem (Item _ (ContractType _) _) = LitBool nowhere True +-- TODO why only Pre items here? +fromItem :: TStorageItem AInteger -> Exp ABoolean +fromItem item@(Item _ (PrimitiveType vt) _) = bound vt (TEntry nowhere Pre item) +fromItem (Item _ (ContractType _) _) = LitBool nowhere True + +mkStorageBoundsLoc :: [StorageLocation] -> [Exp ABoolean] +mkStorageBoundsLoc refs = concatMap mkBound refs + where + mkBound :: StorageLocation -> [Exp ABoolean] + mkBound (Loc SInteger item) = [fromItem item] + mkBound _ = [] mkCallDataBounds :: [Decl] -> [Exp ABoolean] mkCallDataBounds = concatMap $ \(Decl typ name) -> case fromAbiType typ of diff --git a/src/HEVM.hs b/src/HEVM.hs index d4f8509c..53965108 100644 --- a/src/HEVM.hs +++ b/src/HEVM.hs @@ -125,7 +125,7 @@ translateActConstr (Act store [Contract ctor _]) bytecode = translateConstructor translateActConstr (Act _ _) _ = error "TODO multiple contracts" translateConstructor :: Layout -> Constructor -> BS.ByteString -> (Id, [EVM.Expr EVM.End], Calldata, Sig) -translateConstructor layout (Constructor cid iface preconds _ _ upds _) bytecode = +translateConstructor layout (Constructor cid iface preconds _ _ upds) bytecode = (cid, [EVM.Success (snd calldata <> (fmap (toProp layout) $ preconds)) mempty (EVM.ConcreteBuf bytecode) (updatesToExpr layout cid upds initmap)], calldata, ifaceToSig iface) where @@ -163,10 +163,7 @@ ifaceToSig (Interface name args) = Sig (T.pack name) (fmap fromdecl args) translateBehv :: Layout -> BS.ByteString -> Behaviour -> EVM.Expr EVM.End translateBehv layout bytecode (Behaviour _ cid _ preconds caseconds _ upds ret) = - EVM.Success (fmap (toProp layout) $ preconds <> caseconds) mempty (returnsToExpr layout ret) (rewritesToExpr layout cid upds bytecode) - -rewritesToExpr :: Layout -> Id -> [Rewrite] -> BS.ByteString -> ContractMap -rewritesToExpr layout cid rewrites bytecode = foldl (flip $ rewriteToExpr layout cid) initmap rewrites + EVM.Success (fmap (toProp layout) $ preconds <> caseconds) mempty (returnsToExpr layout ret) (updatesToExpr layout cid upds initmap) where initcontract = EVM.C { EVM.code = EVM.RuntimeCode (EVM.ConcreteRuntimeCode bytecode) , EVM.storage = EVM.AbstractStore initAddr @@ -175,10 +172,6 @@ rewritesToExpr layout cid rewrites bytecode = foldl (flip $ rewriteToExpr layout } initmap = M.fromList [(initAddr, initcontract)] -rewriteToExpr :: Layout -> Id -> Rewrite -> ContractMap -> ContractMap -rewriteToExpr _ _ (Constant _) cmap = cmap -rewriteToExpr layout cid (Rewrite upd) cmap = updateToExpr layout cid upd cmap - updatesToExpr :: Layout -> Id -> [StorageUpdate] -> ContractMap -> ContractMap updatesToExpr layout cid upds initmap = foldl (flip $ updateToExpr layout cid) initmap upds diff --git a/src/K.hs b/src/K.hs deleted file mode 100644 index 56a6c8d3..00000000 --- a/src/K.hs +++ /dev/null @@ -1,313 +0,0 @@ -{-# LANGUAGE RecordWildCards #-} -{-# Language GADTs #-} -{-# Language OverloadedStrings #-} -{-# Language ScopedTypeVariables #-} -{-# Language TypeApplications #-} -{-# LANGUAGE ApplicativeDo #-} -{-# LANGUAGE OverloadedLists #-} - -module K where - -import Prelude hiding (GT, LT) - -import Syntax -import Syntax.Annotated hiding (SlotType(..)) - -import Error -import Data.Text (Text, pack, unpack) -import Data.List hiding (group) -import Data.Maybe -import qualified Data.Text as Text -import EVM.Types hiding (Expr(..)) - -import EVM.Solidity (SolcContract(..), StorageItem(..), SlotType(..)) -import Data.Map.Strict (Map) -- abandon in favor of [(a,b)]? -import qualified Data.Map.Strict as Map -- abandon in favor of [(a,b)]? - --- Transforms a RefinedSyntax.Behaviour --- to a k spec. - -type Err = Error String - -cell :: String -> String -> String -cell key value = "<" <> key <> "> " <> value <> " key <> "> \n" - -(|-) :: String -> String -> String -(|-) = cell - -infix 7 |- - -type KSpec = String - -getContractName :: Text -> String -getContractName = unpack . Text.concat . Data.List.tail . Text.splitOn ":" - -data KOptions = - KOptions { - gasExprs :: Map Id String, - storage :: Maybe String, - extractbin :: Bool - } - -makekSpec :: Map Text SolcContract -> KOptions -> Behaviour -> Err (String, String) -makekSpec sources _ behaviour = - let this = _contract behaviour - names = Map.fromList $ fmap (\(a, b) -> (getContractName a, b)) (Map.toList sources) - hasLayout = Map.foldr ((&&) . isJust . (\ SolcContract{..} -> storageLayout)) True sources - in - if hasLayout then do - thisSource <- validate - [(nowhere, unlines ["Bytecode not found for:", show this, "Sources available:", show $ Map.keys sources])] - (Map.lookup this) names - pure $ mkTerm thisSource names behaviour - - else throw (nowhere, "No storagelayout found") - -kCalldata :: Interface -> String -kCalldata (Interface a args) = - "#abiCallData(" - <> show a <> ", " - <> if null args then ".IntList" - else intercalate ", " (fmap (\(Decl typ varname) -> "#" <> show typ <> "(" <> kVar varname <> ")") args) - <> ")" - -kStorageName :: When -> TStorageItem a -> String -kStorageName t item = kVar (idFromItem item) <> "-" <> show t - <> intercalate "_" ("" : fmap kTypedExpr (ixsFromItem item)) - -kVar :: Id -> String -kVar a = (unpack . Text.toUpper . pack $ [head a]) <> tail a - -kAbiEncode :: Maybe TypedExp -> String -kAbiEncode Nothing = ".ByteArray" -kAbiEncode (Just (TExp SInteger a)) = "#enc(#uint256" <> kExpr a <> ")" -kAbiEncode (Just (TExp SBoolean _)) = ".ByteArray" -kAbiEncode (Just (TExp SByteStr _)) = ".ByteArray" -kAbiEncode (Just (TExp SContract _)) = error "contracts not supported" - -kTypedExpr :: TypedExp -> String -kTypedExpr (TExp SInteger a) = kExpr a -kTypedExpr (TExp SBoolean a) = kExpr a -kTypedExpr (TExp SByteStr _) = error "TODO: add support for TExp SByteStr to kExpr" -kTypedExpr (TExp SContract _) = error "contracts not supported" - -kExpr :: Exp a -> String --- integers -kExpr (Add _ a b) = "(" <> kExpr a <> " +Int " <> kExpr b <> ")" -kExpr (Sub _ a b) = "(" <> kExpr a <> " -Int " <> kExpr b <> ")" -kExpr (Mul _ a b) = "(" <> kExpr a <> " *Int " <> kExpr b <> ")" -kExpr (Div _ a b) = "(" <> kExpr a <> " /Int " <> kExpr b <> ")" -kExpr (Mod _ a b) = "(" <> kExpr a <> " modInt " <> kExpr b <> ")" -kExpr (Exp _ a b) = "(" <> kExpr a <> " ^Int " <> kExpr b <> ")" -kExpr (LitInt _ a) = show a -kExpr (IntMin p a) = kExpr $ LitInt p $ negate $ 2 ^ (a - 1) -kExpr (IntMax p a) = kExpr $ LitInt p $ 2 ^ (a - 1) - 1 -kExpr (UIntMin p _) = kExpr $ LitInt p 0 -kExpr (UIntMax p a) = kExpr $ LitInt p $ 2 ^ a - 1 -kExpr (IntEnv _ a) = show a - --- booleans -kExpr (And _ a b) = "(" <> kExpr a <> " andBool\n " <> kExpr b <> ")" -kExpr (Or _ a b) = "(" <> kExpr a <> " orBool " <> kExpr b <> ")" -kExpr (Impl _ a b) = "(" <> kExpr a <> " impliesBool " <> kExpr b <> ")" -kExpr (Neg _ a) = "notBool (" <> kExpr a <> ")" -kExpr (LT _ a b) = "(" <> kExpr a <> " kExpr b <> ")" -kExpr (LEQ _ a b) = "(" <> kExpr a <> " <=Int " <> kExpr b <> ")" -kExpr (GT _ a b) = "(" <> kExpr a <> " >Int " <> kExpr b <> ")" -kExpr (GEQ _ a b) = "(" <> kExpr a <> " >=Int " <> kExpr b <> ")" -kExpr (LitBool _ a) = show a -kExpr (NEq p t a b) = "notBool (" <> kExpr (Eq p t a b) <> ")" -kExpr (Eq _ t a b) = - let eqK typ = "(" <> kExpr a <> " ==" <> typ <> " " <> kExpr b <> ")" - in case t of - SInteger -> eqK "Int" - SBoolean -> eqK "Bool" - SByteStr -> eqK "K" - SContract -> error "contracts not supported" - --- bytestrings -kExpr (ByStr _ str) = show str -kExpr (ByLit _ bs) = show bs -kExpr (TEntry _ t item) = kStorageName t item -kExpr (Var _ _ _ a) = kVar a -kExpr v = error ("Internal error: TODO kExpr of " <> show v) ---kExpr (Cat a b) = ---kExpr (Slice a start end) = ---kExpr (ByEnv env) = - -fst' :: (a, b, c) -> a -fst' (x, _, _) = x - -snd' :: (a, b, c) -> b -snd' (_, y, _) = y - -trd' :: (a, b, c) -> c -trd' (_, _, z) = z - -kStorageEntry :: Map Text StorageItem -> Rewrite -> (String, (Int, String, String)) -kStorageEntry storageLayout update = - let (loc, offset) = kSlot update $ - fromMaybe - (error "Internal error: storageVar not found, please report this error") - (Map.lookup (pack (idFromRewrite update)) storageLayout) - in case update of - Rewrite (Update _ a b) -> (loc, (offset, kStorageName Pre a, kExpr b)) - Constant (Loc SInteger a) -> (loc, (offset, kStorageName Pre a, kStorageName Pre a)) - v -> error $ "Internal error: TODO kStorageEntry: " <> show v -- TODO should this really be separate? - ---packs entries packed in one slot -normalize :: Bool -> [(String, (Int, String, String))] -> String -normalize pass entries = foldr (\a acc -> case a of - (loc, [(_, pre, post)]) -> - loc <> " |-> (" <> pre - <> " => " <> (if pass then post else "_") <> ")\n" - <> acc - (loc, items) -> let (offsets, pres, posts) = unzip3 items - in loc <> " |-> ( #packWords(" - <> showSList (fmap show offsets) <> ", " - <> showSList pres <> ") " - <> " => " <> (if pass - then "#packWords(" - <> showSList (fmap show offsets) - <> ", " <> showSList posts <> ")" - else "_") - <> ")\n" - <> acc - ) - "\n" (group entries) - where group :: [(String, (Int, String, String))] -> [(String, [(Int, String, String)])] - group a = Map.toList (foldr (\(slot, (offset, pre, post)) acc -> Map.insertWith (<>) slot [(offset, pre, post)] acc) mempty a) - showSList :: [String] -> String - showSList = unwords - -kSlot :: Rewrite -> StorageItem -> (String, Int) -kSlot update StorageItem{..} = case slotType of - (StorageValue _) -> (show slot, offset) - (StorageMapping _ _) -> if null (ixsFromRewrite update) - then error $ "internal error: kSlot. Please report: " <> show update - else ( "#hashedLocation(\"Solidity\", " - <> show slot <> ", " <> unwords (kTypedExpr <$> ixsFromRewrite update) <> ")" - , offset ) - -kAccount :: Bool -> Id -> SolcContract -> [Rewrite] -> String -kAccount pass name SolcContract{..} updates = - "account" |- ("\n" - <> "acctID" |- kVar name - <> "balance" |- (kVar name <> "_balance") -- needs to be constrained to uint256 - <> "code" |- (kByteStack runtimeCode) - <> "storage" |- (normalize pass ( fmap (kStorageEntry (fromJust storageLayout)) updates) <> "\n.Map") - <> "origStorage" |- ".Map" -- need to be generalized once "kStorageEntry" is implemented - <> "nonce" |- "_" - ) - -kByteStack :: ByteString -> String -kByteStack bs = "#parseByteStack(\"" <> show (ByteStringS bs) <> "\")" - -defaultConditions :: String -> String -defaultConditions acct_id = - "#rangeAddress(" <> acct_id <> ")\n" <> - "andBool " <> acct_id <> " =/=Int 0\n" <> - "andBool " <> acct_id <> " >Int 9\n" <> - "andBool #rangeAddress( " <> show Caller <> ")\n" <> - "andBool #rangeAddress( " <> show Origin <> ")\n" <> - "andBool #rangeUInt(256, " <> show Timestamp <> ")\n" <> - -- "andBool #rangeUInt(256, ECREC_BAL)" <> - -- "andBool #rangeUInt(256, SHA256_BAL)" <> - -- "andBool #rangeUInt(256, RIP160_BAL)" <> - -- "andBool #rangeUInt(256, ID_BAL)" <> - -- "andBool #rangeUInt(256, MODEXP_BAL)" <> - -- "andBool #rangeUInt(256, ECADD_BAL)" <> - -- "andBool #rangeUInt(256, ECMUL_BAL)" <> - -- "andBool #rangeUInt(256, ECPAIRING_BAL)" <> - "andBool " <> show Calldepth <> " <=Int 1024\n" <> - "andBool #rangeUInt(256, " <> show Callvalue <> ")\n" <> - "andBool #rangeUInt(256, " <> show Chainid <> " )\n" - -indent :: Int -> String -> String -indent n text = unlines $ ((Data.List.replicate n ' ') <>) <$> (lines text) - -mkTerm :: SolcContract -> Map Id SolcContract -> Behaviour -> (String, String) -mkTerm SolcContract{..} accounts Behaviour{..} = (name, term) - where code = runtimeCode - pass = True - repl '_' = '.' - repl c = c - name = _contract <> "_" <> _name - term = "rule [" <> (fmap repl name) <> "]:\n" - <> "k" |- "#execute => #halt" - <> "exit-code" |- "1" - <> "mode" |- "NORMAL" - <> "schedule" |- "ISTANBUL" - <> "evm" |- indent 2 ("\n" - <> "output" |- kAbiEncode _returns - <> "statusCode" |- "EVMC_SUCCESS" - <> "callStack" |- "CallStack" - <> "interimStates" |- "_" - <> "touchedAccounts" |- "_" - <> "callState" |- indent 2 ("\n" - <> "program" |- kByteStack code - <> "jumpDests" |- ("#computeValidJumpDests(" <> kByteStack code <> ")") - <> "id" |- kVar _contract - <> "caller" |- (show Caller) - <> "callData" |- kCalldata _interface - <> "callValue" |- (show Callvalue) - -- the following are set to the values they have - -- at the beginning of a CALL. They can take a - -- more general value in "internal" specs. - <> "wordStack" |- ".WordStack => _" - <> "localMem" |- ".Map => _" - <> "pc" |- "0 => _" - <> "gas" |- "300000 => _" -- can be generalized in the future - <> "memoryUsed" |- "0 => _" - <> "callGas" |- "_ => _" - <> "static" |- "false" -- TODO: generalize - <> "callDepth" |- (show Calldepth) - ) - <> "substate" |- indent 2 ("\n" - <> "selfDestruct" |- "_ => _" - <> "log" |- "_ => _" --TODO: spec logs? - <> "refund" |- "_ => _" - ) - <> "gasPrice" |- "_" --could be environment var - <> "origin" |- show Origin - <> "blockhashes" |- "_" - <> "block" |- indent 2 ("\n" - <> "previousHash" |- "_" - <> "ommersHash" |- "_" - <> "coinbase" |- (show Coinbase) - <> "stateRoot" |- "_" - <> "transactionsRoot" |- "_" - <> "receiptsRoot" |- "_" - <> "logsBloom" |- "_" - <> "difficulty" |- (show Difficulty) - <> "number" |- (show Blocknumber) - <> "gasLimit" |- "_" - <> "gasUsed" |- "_" - <> "timestamp" |- (show Timestamp) - <> "extraData" |- "_" - <> "mixHash" |- "_" - <> "blockNonce" |- "_" - <> "ommerBlockHeaders" |- "_" - ) - ) - <> "network" |- indent 2 ("\n" - <> "activeAccounts" |- "_" - <> "accounts" |- indent 2 ("\n" <> (unpack $ - Text.unlines (flip fmap (contractFromRewrite <$> _stateUpdates) $ \a -> - pack $ - kAccount pass a - (fromMaybe - (error $ show a ++ " not found in accounts: " ++ show accounts) - $ Map.lookup a accounts - ) - (filter (\u -> contractFromRewrite u == a) _stateUpdates) - ))) - <> "txOrder" |- "_" - <> "txPending" |- "_" - <> "messages" |- "_" - ) - <> "\nrequires " - <> defaultConditions (kVar _contract) <> "\n andBool\n" - <> kExpr (mconcat _preconditions) - <> "\nensures " - <> kExpr (mconcat _postconditions) diff --git a/src/Parse.y b/src/Parse.y index 9aaaadea..07704390 100644 --- a/src/Parse.y +++ b/src/Parse.y @@ -201,7 +201,6 @@ Precondition : 'iff' nonempty(Expr) { Iff (posn $1) $2 } | 'iff in range' AbiType nonempty(Expr) { IffIn (posn $1) $2 $3 } Store : Entry '=>' Expr { Rewrite $1 $3 } - | Entry { Constant $1 } Entry : id { EVar (posn $1) (name $1) } | Entry '[' Expr ']' list(Index) { EMapping (posn $2) $1 ($3:$5) } diff --git a/src/Print.hs b/src/Print.hs index 9b526967..e4dce6c7 100644 --- a/src/Print.hs +++ b/src/Print.hs @@ -31,10 +31,7 @@ prettyBehaviour (Behaviour name contract interface preconditions cases postcondi prettyCases p = header "case" >-< block (prettyExp <$> p) <> ":" prettyStorage [] = "" - prettyStorage s = header "storage" >-< block (prettyState <$> s) - - prettyState (Constant loc) = prettyLocation loc - prettyState (Rewrite rew) = prettyUpdate rew + prettyStorage s = header "storage" >-< block (prettyUpdate <$> s) prettyRet (Just ret) = header "returns" >-< " " <> prettyTypedExp ret prettyRet Nothing = "" diff --git a/src/SMT.hs b/src/SMT.hs index fd275b20..bc7e7955 100644 --- a/src/SMT.hs +++ b/src/SMT.hs @@ -188,7 +188,8 @@ mkPostconditionQueriesBehv :: Behaviour -> [Query] mkPostconditionQueriesBehv behv@(Behaviour _ _ (Interface ifaceName decls) preconds caseconds postconds stateUpdates _) = mkQuery <$> postconds where -- declare vars - storage = concatMap (declareStorageLocation . locFromRewrite) stateUpdates + activeLocs = locsFromBehaviour behv -- TODO this might contain redundant locations if invariants use locations that are not mentioned elsewhere in the behaviour + storage = concatMap declareStorageLocation activeLocs args = declareArg ifaceName <$> decls envs = declareEthEnv <$> ethEnvFromBehaviour behv @@ -205,24 +206,23 @@ mkPostconditionQueriesBehv behv@(Behaviour _ _ (Interface ifaceName decls) preco mkQuery e = Postcondition (Behv behv) e (mksmt e) mkPostconditionQueriesConstr :: Constructor -> [Query] -mkPostconditionQueriesConstr constructor@(Constructor _ (Interface ifaceName decls) preconds postconds _ initialStorage stateUpdates) = mkQuery <$> postconds +mkPostconditionQueriesConstr constructor@(Constructor _ (Interface ifaceName decls) preconds postconds _ initialStorage) = mkQuery <$> postconds where -- declare vars - localStorage = concatMap declareInitialStorage initialStorage - externalStorage = concatMap (declareStorageLocation . locFromRewrite) stateUpdates + activeLocs = locsFromConstructor constructor + localStorage = concatMap declareInitialStorage activeLocs args = declareArg ifaceName <$> decls envs = declareEthEnv <$> ethEnvFromConstructor constructor -- constraints pres = mkAssert ifaceName <$> preconds - updates = encodeUpdate ifaceName <$> stateUpdates initialStorage' = encodeInitialStorage ifaceName <$> initialStorage mksmt e = SMTExp - { _storage = localStorage <> externalStorage + { _storage = localStorage , _calldata = args , _environment = envs - , _assertions = [mkAssert ifaceName . Neg nowhere $ e] <> pres <> updates <> initialStorage' + , _assertions = [mkAssert ifaceName . Neg nowhere $ e] <> pres <> initialStorage' } mkQuery e = Postcondition (Ctor constructor) e (mksmt e) @@ -253,49 +253,51 @@ mkInvariantQueries (Act _ contracts) = fmap mkQuery gathered getInvariants (Contract (c@Constructor{..}) behvs) = fmap (\i -> (i, c, behvs)) _invariants mkInit :: Invariant -> Constructor -> (Constructor, SMTExp) - mkInit (Invariant _ invConds _ (_,invPost)) ctor@(Constructor _ (Interface ifaceName decls) preconds _ _ initialStorage stateUpdates) = (ctor, smt) + mkInit (Invariant _ invConds _ (_,invPost)) ctor@(Constructor _ (Interface ifaceName decls) preconds _ _ initialStorage) = (ctor, smt) where -- declare vars - localStorage = concatMap declareInitialStorage initialStorage - externalStorage = concatMap (declareStorageLocation . locFromRewrite) stateUpdates + activeLocs = locsFromConstructor ctor + localStorage = concatMap declareInitialStorage activeLocs args = declareArg ifaceName <$> decls envs = declareEthEnv <$> ethEnvFromConstructor ctor -- constraints pres = mkAssert ifaceName <$> preconds <> invConds - updates = encodeUpdate ifaceName <$> stateUpdates initialStorage' = encodeInitialStorage ifaceName <$> initialStorage postInv = mkAssert ifaceName $ Neg nowhere invPost smt = SMTExp - { _storage = localStorage <> externalStorage + { _storage = localStorage , _calldata = args , _environment = envs - , _assertions = postInv : pres <> updates <> initialStorage' + , _assertions = postInv : pres <> initialStorage' } mkBehv :: Invariant -> Constructor -> Behaviour -> (Behaviour, SMTExp) - mkBehv (Invariant _ invConds invStorageBounds (invPre,invPost)) ctor behv = (behv, smt) + mkBehv inv@(Invariant _ invConds invStorageBounds (invPre,invPost)) ctor behv = (behv, smt) where (Interface ctorIface ctorDecls) = _cinterface ctor (Interface behvIface behvDecls) = _interface behv - -- storage locs mentioned in the invariant but not in the behaviour - implicitLocs = Constant <$> (locsFromExp invPre \\ (locFromRewrite <$> _stateUpdates behv)) + + -- storage locs that are mentioned but not explictly updated (i.e., constant) + implicitLocs = (activeLocs \\ fmap locFromUpdate (_stateUpdates behv)) -- declare vars invEnv = declareEthEnv <$> ethEnvFromExp invPre behvEnv = declareEthEnv <$> ethEnvFromBehaviour behv initArgs = declareArg ctorIface <$> ctorDecls behvArgs = declareArg behvIface <$> behvDecls - storage = concatMap (declareStorageLocation . locFromRewrite) (_stateUpdates behv <> implicitLocs) + activeLocs = nub $ locsFromBehaviour behv <> locsFromInvariant inv + + storage = concatMap declareStorageLocation activeLocs -- constraints preInv = mkAssert ctorIface $ invPre postInv = mkAssert ctorIface . Neg nowhere $ invPost behvConds = mkAssert behvIface <$> _preconditions behv <> _caseconditions behv invConds' = mkAssert ctorIface <$> invConds <> invStorageBounds - implicitLocs' = encodeUpdate ctorIface <$> implicitLocs + implicitLocs' = encodeStorageLocation <$> implicitLocs -- TODO why do we need to assert this updates = encodeUpdate behvIface <$> _stateUpdates behv smt = SMTExp @@ -326,6 +328,7 @@ runQuery solver query@(Inv (Invariant _ _ _ predicate) (ctor, ctorSMT) behvs) = -- provided `modelFn` to extract a model if the solver returns `sat` checkSat :: SolverInstance -> (SolverInstance -> IO Model) -> SMTExp -> IO SMTResult checkSat solver modelFn smt = do + -- render (pretty smt) err <- sendLines solver ("(reset)" : (lines . show . pretty $ smt)) case err of Nothing -> do @@ -529,6 +532,7 @@ parseSMTModel s = if length s0Caps == 1 -- | encodes a storage update from a constructor creates block as an smt assertion +-- TODO unify with encodeUpdate encodeInitialStorage :: Id -> StorageUpdate -> SMT2 encodeInitialStorage behvName (Update _ item expr) = let @@ -536,6 +540,8 @@ encodeInitialStorage behvName (Update _ item expr) = expression = withInterface behvName $ expToSMT2 expr in "(assert (= " <> postentry <> " " <> expression <> "))" +encodeStorageLocation :: StorageLocation -> SMT2 +encodeStorageLocation loc = "(assert (= " <> nameFromLoc Pre loc <> " " <> nameFromLoc Post loc <> "))" -- | declares a storage location with the given timing declareStorage :: [When] -> StorageLocation -> [SMT2] @@ -548,13 +554,12 @@ declareStorage times (Loc _ item@(Item _ _ ref)) = declareRef ref -- | declares a storage location that is created by the constructor, these -- locations have no prestate, so we declare a post var only -declareInitialStorage :: StorageUpdate -> [SMT2] -declareInitialStorage upd = declareStorage [Post] (locFromUpdate upd) +declareInitialStorage :: StorageLocation -> [SMT2] +declareInitialStorage loc = declareStorage [Post] loc -- | encodes a storage update rewrite as an smt assertion -encodeUpdate :: Id -> Rewrite -> SMT2 -encodeUpdate _ (Constant loc) = "(assert (= " <> nameFromLoc Pre loc <> " " <> nameFromLoc Post loc <> "))" -encodeUpdate behvName (Rewrite update) = encodeInitialStorage behvName update +encodeUpdate :: Id -> StorageUpdate -> SMT2 +encodeUpdate behvName update = encodeInitialStorage behvName update -- | declares a storage location that exists both in the pre state and the post -- state (i.e. anything except a loc created by a constructor claim) diff --git a/src/Syntax.hs b/src/Syntax.hs index 46349683..152c10ab 100644 --- a/src/Syntax.hs +++ b/src/Syntax.hs @@ -18,7 +18,7 @@ import Data.Map (Map,empty,insertWith,unionsWith,unionWith,singleton) import Syntax.TimeAgnostic as Agnostic import qualified Syntax.Annotated as Annotated import qualified Syntax.Typed as Typed -import Syntax.Untyped hiding (Constant,Rewrite,Contract) +import Syntax.Untyped hiding (Contract) import qualified Syntax.Untyped as Untyped ----------------------------------------- @@ -34,16 +34,15 @@ locsFromBehaviour (Behaviour _ _ _ preconds cases postconds rewrites returns) = concatMap locsFromExp preconds <> concatMap locsFromExp cases <> concatMap locsFromExp postconds - <> concatMap locsFromRewrite rewrites + <> concatMap locsFromUpdate rewrites <> maybe [] locsFromTypedExp returns locsFromConstructor :: Annotated.Constructor -> [Annotated.StorageLocation] -locsFromConstructor (Constructor _ _ pre post inv initialStorage rewrites) = nub $ +locsFromConstructor (Constructor _ _ pre post inv initialStorage) = nub $ concatMap locsFromExp pre <> concatMap locsFromExp post <> concatMap locsFromInvariant inv - <> concatMap locsFromRewrite rewrites - <> concatMap locsFromRewrite (Rewrite <$> initialStorage) + <> concatMap locsFromUpdate initialStorage locsFromInvariant :: Annotated.Invariant -> [Annotated.StorageLocation] locsFromInvariant (Invariant _ pre bounds (predpre, predpost)) = @@ -63,19 +62,15 @@ behvsFromContracts contracts = concatMap (\(Contract _ b) -> b) contracts constrFromContracts :: [Contract t] -> [Constructor t] constrFromContracts contracts = fmap (\(Contract c _) -> c) contracts -locsFromRewrite :: Rewrite t -> [StorageLocation t] -locsFromRewrite update = nub $ case update of - Constant loc -> [loc] - Rewrite (Update _ item e) -> locsFromItem item <> locsFromExp e - -locFromRewrite :: Rewrite t -> StorageLocation t -locFromRewrite = onRewrite id locFromUpdate +locsFromUpdate :: StorageUpdate t -> [StorageLocation t] +locsFromUpdate update = nub $ case update of + (Update _ item e) -> locsFromItem item <> locsFromExp e locFromUpdate :: StorageUpdate t -> StorageLocation t locFromUpdate (Update _ item _) = _Loc item locsFromItem :: TStorageItem a t -> [StorageLocation t] -locsFromItem item = _Loc item : concatMap locsFromTypedExp (ixsFromItem item) +locsFromItem item = _Loc item : concatMap locsFromTypedExp (ixsFromItem item) locsFromTypedExp :: TypedExp t -> [StorageLocation t] locsFromTypedExp (TExp _ e) = locsFromExp e @@ -159,7 +154,7 @@ createsFromExp = nub . go Var {} -> [] createsFromItem :: TStorageItem a t -> [Id] -createsFromItem item = concatMap createsFromTypedExp (ixsFromItem item) +createsFromItem item = concatMap createsFromTypedExp (ixsFromItem item) createsFromTypedExp :: TypedExp t -> [Id] createsFromTypedExp (TExp _ e) = createsFromExp e @@ -168,28 +163,26 @@ createsFromContract :: Typed.Contract -> [Id] createsFromContract (Contract constr behvs) = createsFromConstructor constr <> concatMap createsFromBehaviour behvs -createsFromConstructor :: Typed.Constructor -> [Id] -createsFromConstructor (Constructor _ _ pre post inv initialStorage rewrites) = nub $ +createsFromConstructor :: Typed.Constructor -> [Id] +createsFromConstructor (Constructor _ _ pre post inv initialStorage) = nub $ concatMap createsFromExp pre <> concatMap createsFromExp post <> concatMap createsFromInvariant inv - <> concatMap createsFromRewrite rewrites - <> concatMap createsFromRewrite (Rewrite <$> initialStorage) + <> concatMap createsFromUpdate initialStorage createsFromInvariant :: Typed.Invariant -> [Id] createsFromInvariant (Invariant _ pre bounds ipred) = concatMap createsFromExp pre <> concatMap createsFromExp bounds <> createsFromExp ipred -createsFromRewrite :: Rewrite t ->[Id] -createsFromRewrite update = nub $ case update of - Constant _ -> [] - Rewrite (Update _ item e) -> createsFromItem item <> createsFromExp e +createsFromUpdate :: StorageUpdate t ->[Id] +createsFromUpdate update = nub $ case update of + Update _ item e -> createsFromItem item <> createsFromExp e createsFromBehaviour :: Behaviour t -> [Id] createsFromBehaviour (Behaviour _ _ _ _ preconds postconds rewrites returns) = nub $ concatMap createsFromExp preconds <> concatMap createsFromExp postconds - <> concatMap createsFromRewrite rewrites + <> concatMap createsFromUpdate rewrites <> maybe [] createsFromTypedExp returns ethEnvFromBehaviour :: Behaviour t -> [EthEnv] @@ -197,26 +190,24 @@ ethEnvFromBehaviour (Behaviour _ _ _ preconds cases postconds rewrites returns) concatMap ethEnvFromExp preconds <> concatMap ethEnvFromExp cases <> concatMap ethEnvFromExp postconds - <> concatMap ethEnvFromRewrite rewrites + <> concatMap ethEnvFromUpdate rewrites <> maybe [] ethEnvFromTypedExp returns ethEnvFromConstructor :: Annotated.Constructor -> [EthEnv] -ethEnvFromConstructor (Constructor _ _ pre post inv initialStorage rewrites) = nub $ +ethEnvFromConstructor (Constructor _ _ pre post inv initialStorage) = nub $ concatMap ethEnvFromExp pre <> concatMap ethEnvFromExp post <> concatMap ethEnvFromInvariant inv - <> concatMap ethEnvFromRewrite rewrites - <> concatMap ethEnvFromRewrite (Rewrite <$> initialStorage) + <> concatMap ethEnvFromUpdate initialStorage ethEnvFromInvariant :: Annotated.Invariant -> [EthEnv] ethEnvFromInvariant (Invariant _ pre bounds (predpre, predpost)) = concatMap ethEnvFromExp pre <> concatMap ethEnvFromExp bounds <> ethEnvFromExp predpre <> ethEnvFromExp predpost -ethEnvFromRewrite :: Rewrite t -> [EthEnv] -ethEnvFromRewrite rewrite = case rewrite of - Constant (Loc _ item) -> ethEnvFromItem item - Rewrite (Update _ item e) -> nub $ ethEnvFromItem item <> ethEnvFromExp e +ethEnvFromUpdate :: StorageUpdate t -> [EthEnv] +ethEnvFromUpdate rewrite = case rewrite of + Update _ item e -> nub $ ethEnvFromItem item <> ethEnvFromExp e ethEnvFromItem :: TStorageItem a t -> [EthEnv] ethEnvFromItem = nub . concatMap ethEnvFromTypedExp . ixsFromItem @@ -263,9 +254,6 @@ ethEnvFromExp = nub . go TEntry _ _ a -> ethEnvFromItem a Var {} -> [] -idFromRewrite :: Rewrite t -> Id -idFromRewrite = onRewrite idFromLocation idFromUpdate - idFromItem :: TStorageItem a t -> Id idFromItem (Item _ _ ref) = idFromStorageRef ref @@ -280,9 +268,6 @@ idFromUpdate (Update _ item _) = idFromItem item idFromLocation :: StorageLocation t -> Id idFromLocation (Loc _ item) = idFromItem item -contractFromRewrite :: Rewrite t -> Id -contractFromRewrite = onRewrite contractFromLoc contractFromUpdate - contractFromItem :: TStorageItem a t -> Id contractFromItem (Item _ _ ref) = contractFromStorageRef ref @@ -296,7 +281,7 @@ ixsFromItem (Item _ _ (SMapping _ _ ixs)) = ixs ixsFromItem _ = [] contractsInvolved :: Behaviour t -> [Id] -contractsInvolved = fmap contractFromRewrite . _stateUpdates +contractsInvolved = fmap contractFromUpdate . _stateUpdates contractFromLoc :: StorageLocation t -> Id contractFromLoc (Loc _ item) = contractFromItem item @@ -310,32 +295,18 @@ ixsFromLocation (Loc _ item) = ixsFromItem item ixsFromUpdate :: StorageUpdate t -> [TypedExp t] ixsFromUpdate (Update _ item _) = ixsFromItem item -ixsFromRewrite :: Rewrite t -> [TypedExp t] -ixsFromRewrite = onRewrite ixsFromLocation ixsFromUpdate - itemType :: TStorageItem a t -> ActType itemType (Item t _ _) = actType t isMapping :: StorageLocation t -> Bool isMapping = not . null . ixsFromLocation -onRewrite :: (StorageLocation t -> a) -> (StorageUpdate t -> a) -> Rewrite t -> a -onRewrite f _ (Constant a) = f a -onRewrite _ g (Rewrite a) = g a - -updatesFromRewrites :: [Rewrite t] -> [StorageUpdate t] -updatesFromRewrites rs = [u | Rewrite u <- rs] - -locsFromRewrites :: [Rewrite t] -> [StorageLocation t] -locsFromRewrites rs = [l | Constant l <- rs] - -------------------------------------- -- * Extraction from untyped ASTs * -- -------------------------------------- nameFromStorage :: Untyped.Storage -> Id nameFromStorage (Untyped.Rewrite e _) = nameFromEntry e -nameFromStorage (Untyped.Constant e) = nameFromEntry e nameFromEntry :: Entry -> Id nameFromEntry (EVar _ x) = x @@ -435,7 +406,7 @@ idFromRewrites e = case e of idFromEntry (EVar p x) = singleton x [p] idFromEntry (EMapping _ en xs) = unionWith (<>) (idFromEntry en) (idFromRewrites' xs) idFromEntry (EField _ en _) = idFromEntry en - + -- | True iff the case is a wildcard. isWild :: Case -> Bool isWild (Case _ (WildExp _) _) = True diff --git a/src/Syntax/Annotated.hs b/src/Syntax/Annotated.hs index da93016f..d32fc57e 100644 --- a/src/Syntax/Annotated.hs +++ b/src/Syntax/Annotated.hs @@ -13,8 +13,8 @@ import qualified Syntax.TimeAgnostic as Agnostic import Syntax.TimeAgnostic (Timing(..),setPre,setPost) -- Reexports -import Syntax.TimeAgnostic as Syntax.Annotated hiding (Timing(..),Timable(..),Time,Neither,Act,Contract,Invariant,InvariantPred,Constructor,Behaviour,Rewrite,StorageUpdate,StorageLocation,TStorageItem,Exp,TypedExp,StorageRef) -import Syntax.TimeAgnostic as Syntax.Annotated (pattern Act, pattern Contract, pattern Invariant, pattern Constructor, pattern Behaviour, pattern Rewrite, pattern Exp) +import Syntax.TimeAgnostic as Syntax.Annotated hiding (Timing(..),Timable(..),Time,Neither,Act,Contract,Invariant,InvariantPred,Constructor,Behaviour,StorageUpdate,StorageLocation,TStorageItem,Exp,TypedExp,StorageRef) +import Syntax.TimeAgnostic as Syntax.Annotated (pattern Act, pattern Contract, pattern Invariant, pattern Constructor, pattern Behaviour, pattern Exp) -- We shadow all timing-agnostic AST types with explicitly timed versions. @@ -24,7 +24,6 @@ type Invariant = Agnostic.Invariant Timed type InvariantPred = Agnostic.InvariantPred Timed type Constructor = Agnostic.Constructor Timed type Behaviour = Agnostic.Behaviour Timed -type Rewrite = Agnostic.Rewrite Timed type StorageUpdate = Agnostic.StorageUpdate Timed type StorageLocation = Agnostic.StorageLocation Timed type StorageRef = Agnostic.StorageRef Timed @@ -53,7 +52,6 @@ instance Annotatable Agnostic.Constructor where annotate ctor@Constructor{..} = ctor { _cpreconditions = setPre <$> _cpreconditions , _initialStorage = annotate <$> _initialStorage - , _cstateUpdates = annotate <$> _cstateUpdates , _invariants = annotate <$> _invariants } @@ -64,9 +62,5 @@ instance Annotatable Agnostic.Behaviour where , _stateUpdates = annotate <$> _stateUpdates } -instance Annotatable Agnostic.Rewrite where - annotate (Constant location) = Constant $ setPre location - annotate (Rewrite update) = Rewrite $ annotate update - instance Annotatable Agnostic.StorageUpdate where annotate (Update typ item expr) = Update typ (setPost item) (setPre expr) diff --git a/src/Syntax/TimeAgnostic.hs b/src/Syntax/TimeAgnostic.hs index 7204a001..c5749bb6 100644 --- a/src/Syntax/TimeAgnostic.hs +++ b/src/Syntax/TimeAgnostic.hs @@ -101,7 +101,6 @@ data Constructor t = Constructor , _cpostconditions :: [Exp ABoolean Timed] , _invariants :: [Invariant t] , _initialStorage :: [StorageUpdate t] - , _cstateUpdates :: [Rewrite t] } deriving instance Show (InvariantPred t) => Show (Constructor t) deriving instance Eq (InvariantPred t) => Eq (Constructor t) @@ -114,15 +113,10 @@ data Behaviour t = Behaviour , _preconditions :: [Exp ABoolean t] -- if preconditions are not satisfied execution is reverted , _caseconditions :: [Exp ABoolean t] -- if preconditions are satisfied and a case condition is not, some other instance of the bahaviour should apply , _postconditions :: [Exp ABoolean Timed] - , _stateUpdates :: [Rewrite t] + , _stateUpdates :: [StorageUpdate t] , _returns :: Maybe (TypedExp Timed) } deriving (Show, Eq) -data Rewrite t - = Constant (StorageLocation t) - | Rewrite (StorageUpdate t) - deriving (Show, Eq) - data StorageUpdate (t :: Timing) where Update :: SType a -> TStorageItem a t -> Exp a t -> StorageUpdate t deriving instance Show (StorageUpdate t) @@ -425,10 +419,6 @@ invariantJSON Invariant{..} predicate = object [ "kind" .= String "Invariant" , "storagebounds" .= toJSON _istoragebounds , "contract" .= _icontract ] -instance ToJSON (Rewrite t) where - toJSON (Constant a) = object [ "constant" .= toJSON a ] - toJSON (Rewrite a) = object [ "rewrite" .= toJSON a ] - instance ToJSON (StorageLocation t) where toJSON (Loc _ a) = object [ "location" .= toJSON a ] diff --git a/src/Syntax/Typed.hs b/src/Syntax/Typed.hs index 7438a2e9..f79d38aa 100644 --- a/src/Syntax/Typed.hs +++ b/src/Syntax/Typed.hs @@ -10,8 +10,8 @@ module Syntax.Typed (module Syntax.Typed) where import qualified Syntax.TimeAgnostic as Agnostic -- Reexports -import Syntax.TimeAgnostic as Syntax.Typed hiding (Act,Contract,Invariant,InvariantPred,Constructor,Behaviour,Rewrite,StorageUpdate,StorageLocation) -import Syntax.TimeAgnostic as Syntax.Typed (pattern Act, pattern Contract, pattern Invariant, pattern Constructor, pattern Behaviour, pattern Rewrite) +import Syntax.TimeAgnostic as Syntax.Typed hiding (Act,Contract,Invariant,InvariantPred,Constructor,Behaviour,StorageUpdate,StorageLocation) +import Syntax.TimeAgnostic as Syntax.Typed (pattern Act, pattern Contract, pattern Invariant, pattern Constructor, pattern Behaviour) -- We shadow all timing-agnostic AST types with versions -- that need to have implicit timings where possible. @@ -20,6 +20,5 @@ type Contract = Agnostic.Contract Untimed type Invariant = Agnostic.Invariant Untimed type Constructor = Agnostic.Constructor Untimed type Behaviour = Agnostic.Behaviour Untimed -type Rewrite = Agnostic.Rewrite Untimed type StorageUpdate = Agnostic.StorageUpdate Untimed type StorageLocation = Agnostic.StorageLocation Untimed diff --git a/src/Syntax/Untyped.hs b/src/Syntax/Untyped.hs index 9c15bd45..436b7b9c 100644 --- a/src/Syntax/Untyped.hs +++ b/src/Syntax/Untyped.hs @@ -56,7 +56,6 @@ newtype Creates = Creates [Assign] data Storage = Rewrite Entry Expr - | Constant Entry deriving (Eq, Show) data Assign = AssignVal StorageVar Expr | AssignMany StorageVar [Defn] | AssignStruct StorageVar [Defn] diff --git a/src/Type.hs b/src/Type.hs index 8dcf4805..778a6adc 100644 --- a/src/Type.hs +++ b/src/Type.hs @@ -128,7 +128,7 @@ topologicalSort (Act store contracts) = -- map a contract name to the list of contracts that it calls and its code findCreates :: Contract -> (Id, ([Id], Contract)) - findCreates c@(Contract (Constructor cname _ _ _ _ _ _) _) = (cname, (createsFromContract c, c)) + findCreates c@(Contract (Constructor cname _ _ _ _ _) _) = (cname, (createsFromContract c, c)) --- Finds storage declarations from constructors lookupVars :: [U.Contract] -> Store @@ -244,7 +244,7 @@ checkTransition env (U.Transition _ name contract iface@(Interface _ decls) iffs -- TODO ensure non-overlapping and exhaustiveness (maybe with elaboration and mandatory wildcard?) -- | split case into pass and fail case - makeBehv :: [Exp ABoolean Untimed] -> [Exp ABoolean Timed] -> ([Exp ABoolean Untimed], [Rewrite], Maybe (TypedExp Timed)) -> Behaviour + makeBehv :: [Exp ABoolean Untimed] -> [Exp ABoolean Timed] -> ([Exp ABoolean Untimed], [StorageUpdate], Maybe (TypedExp Timed)) -> Behaviour makeBehv iffs' postcs (if',storage,ret) = Behaviour name contract iface iffs' if' postcs storage ret checkDefinition :: Env -> U.Definition -> Err Constructor @@ -255,7 +255,7 @@ checkDefinition env (U.Definition _ contract (Interface _ decls) iffs (U.Creates _ <- traverse (validStorage env') assigns ensures <- traverse (checkExpr env' SBoolean) postcs invs' <- fmap (Invariant contract [] []) <$> traverse (checkExpr env' SBoolean) invs - pure $ Constructor contract (Interface contract decls) iffs' ensures invs' stateUpdates [] + pure $ Constructor contract (Interface contract decls) iffs' ensures invs' stateUpdates where env' = addCalldata env decls @@ -282,7 +282,7 @@ validSlotType env p (StorageValue t) = validType env p t -- | Typechecks a case, returning typed versions of its preconditions, rewrites and return value. -checkCase :: Env -> U.Case -> Err ([Exp ABoolean Untimed], [Rewrite], Maybe (TypedExp Timed)) +checkCase :: Env -> U.Case -> Err ([Exp ABoolean Untimed], [StorageUpdate], Maybe (TypedExp Timed)) checkCase env c@(U.Case _ pre post) = do -- TODO isWild checks for WildExp, but WildExp is never generated if' <- traverse (checkExpr env SBoolean) $ if isWild c then [U.BoolLit nowhere True] else [pre] @@ -319,16 +319,15 @@ checkDefn pn env@Env{contract} keyType vt@(FromVType valType) name (U.Defn k val <*> checkExpr env valType val -- | Typechecks a postcondition, returning typed versions of its storage updates and return expression. -checkPost :: Env -> U.Post -> Err ([Rewrite], Maybe (TypedExp Timed)) +checkPost :: Env -> U.Post -> Err ([StorageUpdate], Maybe (TypedExp Timed)) checkPost env@Env{contract,theirs} (U.Post storage maybeReturn) = do returnexp <- traverse (typedExp $ focus contract) maybeReturn storage' <- checkEntries contract storage pure (storage', returnexp) where - checkEntries :: Id -> [U.Storage] -> Err [Rewrite] + checkEntries :: Id -> [U.Storage] -> Err [StorageUpdate] checkEntries name entries = for entries $ \case - U.Constant loc -> Constant <$> checkPattern (focus name) loc - U.Rewrite loc val -> Rewrite <$> checkStorageExpr (focus name) loc val + U.Rewrite loc val -> checkStorageExpr (focus name) loc val focus :: Id -> Env focus name = env @@ -376,11 +375,6 @@ checkStorageExpr env entry expr = assert (p, "Expression is expected to be a contract " <> show c <> " but it is a contract " <> show c) (c == c') validContractType _ _ _ _ = pure () -checkPattern :: Env -> U.Entry -> Err StorageLocation -checkPattern env entry = - validateEntry env entry `bindValidation` \(vt@(FromVType loctyp), ref) -> - pure $ _Loc (Item loctyp vt ref) - checkIffs :: Env -> [U.IffH] -> Err [Exp ABoolean Untimed] checkIffs env = foldr check (pure []) where diff --git a/src/act.cabal b/src/act.cabal index 39625cd4..abb1a958 100644 --- a/src/act.cabal +++ b/src/act.cabal @@ -44,7 +44,7 @@ library hs-source-dirs: . default-language: Haskell2010 exposed-modules: CLI Error Print SMT Syntax.Annotated Syntax.TimeAgnostic - other-modules: Lex Parse K Coq Syntax Syntax.Untyped Syntax.Typed Syntax.Types Syntax.Timing Type Enrich Dev HEVM Consistency + other-modules: Lex Parse Coq Syntax Syntax.Untyped Syntax.Typed Syntax.Types Syntax.Timing Type Enrich Dev HEVM Consistency executable act import: deps diff --git a/src/test/Test.hs b/src/test/Test.hs index 7c7b1e68..3d554063 100644 --- a/src/test/Test.hs +++ b/src/test/Test.hs @@ -73,7 +73,7 @@ defaultStore :: Id -> Store defaultStore c = fromList [(c,fromList [])] defaultCtor :: Id -> Constructor -defaultCtor c = Constructor {_cname = c, _cinterface = Interface c [], _cpreconditions = [], _cpostconditions = [], _invariants = [], _initialStorage = [], _cstateUpdates = []} +defaultCtor c = Constructor {_cname = c, _cinterface = Interface c [], _cpreconditions = [], _cpostconditions = [], _invariants = [], _initialStorage = []} typeCheckSMT :: Solver -> GenT (Reader Bool) Property diff --git a/tests/coq/ERC20/erc20.act b/tests/coq/ERC20/erc20.act index 7a3fc9c9..17d7096c 100644 --- a/tests/coq/ERC20/erc20.act +++ b/tests/coq/ERC20/erc20.act @@ -28,11 +28,6 @@ case CALLER =/= to: case CALLER == to: - storage - - balanceOf[CALLER] - balanceOf[to] - returns 1 @@ -50,8 +45,6 @@ case src =/= dst and CALLER == src: storage - balanceOf[CALLER] - allowance[src][CALLER] balanceOf[src] => balanceOf[src] - amount balanceOf[dst] => balanceOf[dst] + amount @@ -61,8 +54,6 @@ case src =/= dst and CALLER =/= src and allowance[src][CALLER] == 2^256 - 1: storage - balanceOf[CALLER] - allowance[src][CALLER] balanceOf[src] => balanceOf[src] - amount balanceOf[dst] => balanceOf[dst] + amount @@ -72,7 +63,6 @@ case src =/= dst and CALLER =/= src and allowance[src][CALLER] < 2^256 - 1: storage - balanceOf[CALLER] allowance[src][CALLER] => allowance[src][CALLER] - amount balanceOf[src] => balanceOf[src] - amount balanceOf[dst] => balanceOf[dst] + amount @@ -81,11 +71,4 @@ case src =/= dst and CALLER =/= src and allowance[src][CALLER] < 2^256 - 1: case src == dst: - storage - - balanceOf[CALLER] - allowance[src][CALLER] - balanceOf[src] - balanceOf[dst] - returns 1 \ No newline at end of file diff --git a/tests/coq/exponent/exponent.act b/tests/coq/exponent/exponent.act index 33c0474b..bbf976ba 100644 --- a/tests/coq/exponent/exponent.act +++ b/tests/coq/exponent/exponent.act @@ -27,5 +27,4 @@ iff in range uint storage r => r * b - e => e - 1 - b + e => e - 1 \ No newline at end of file diff --git a/tests/frontend/pass/case/case.act.typed.json b/tests/frontend/pass/case/case.act.typed.json index 448d4235..bc357e7d 100644 --- a/tests/frontend/pass/case/case.act.typed.json +++ b/tests/frontend/pass/case/case.act.typed.json @@ -184,23 +184,21 @@ "returns": null, "stateUpdates": [ { - "rewrite": { - "location": { - "item": { - "contract": "C", - "kind": "SVar", - "svar": "x" - }, - "type": "int" + "location": { + "item": { + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "value": { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "z" - } + "type": "int" + }, + "value": { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "z" } } ] @@ -387,33 +385,31 @@ "returns": null, "stateUpdates": [ { - "rewrite": { - "location": { - "item": { - "contract": "C", - "kind": "SVar", - "svar": "x" - }, - "type": "int" + "location": { + "item": { + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "value": { - "args": [ - { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "z" + "type": "int" + }, + "value": { + "args": [ + { + "abitype": { + "size": "256", + "type": "UInt" }, - { - "literal": "1", - "type": "int" - } - ], - "arity": 2, - "symbol": "+" - } + "type": "int", + "var": "z" + }, + { + "literal": "1", + "type": "int" + } + ], + "arity": 2, + "symbol": "+" } } ] @@ -600,33 +596,31 @@ "returns": null, "stateUpdates": [ { - "rewrite": { - "location": { - "item": { - "contract": "C", - "kind": "SVar", - "svar": "x" - }, - "type": "int" + "location": { + "item": { + "contract": "C", + "kind": "SVar", + "svar": "x" }, - "value": { - "args": [ - { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "z" + "type": "int" + }, + "value": { + "args": [ + { + "abitype": { + "size": "256", + "type": "UInt" }, - { - "literal": "2", - "type": "int" - } - ], - "arity": 2, - "symbol": "+" - } + "type": "int", + "var": "z" + }, + { + "literal": "2", + "type": "int" + } + ], + "arity": 2, + "symbol": "+" } } ] diff --git a/tests/frontend/pass/multi/multi.act.typed.json b/tests/frontend/pass/multi/multi.act.typed.json index 48f5fef1..b7ad547a 100644 --- a/tests/frontend/pass/multi/multi.act.typed.json +++ b/tests/frontend/pass/multi/multi.act.typed.json @@ -212,28 +212,26 @@ "returns": null, "stateUpdates": [ { - "rewrite": { - "location": { - "item": { - "contract": "A", - "field": "x", - "kind": "Field", - "reference": { - "contract": "B", - "kind": "SVar", - "svar": "a" - } - }, - "type": "int" + "location": { + "item": { + "contract": "A", + "field": "x", + "kind": "Field", + "reference": { + "contract": "B", + "kind": "SVar", + "svar": "a" + } }, - "value": { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "z" - } + "type": "int" + }, + "value": { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "z" } } ] @@ -464,44 +462,40 @@ "returns": null, "stateUpdates": [ { - "rewrite": { - "location": { - "item": { - "contract": "B", - "kind": "SVar", - "svar": "y" - }, - "type": "int" + "location": { + "item": { + "contract": "B", + "kind": "SVar", + "svar": "y" }, - "value": { - "literal": "1", - "type": "int" - } + "type": "int" + }, + "value": { + "literal": "1", + "type": "int" } }, { - "rewrite": { - "location": { - "item": { - "contract": "A", - "field": "x", - "kind": "Field", - "reference": { - "contract": "B", - "kind": "SVar", - "svar": "a" - } - }, - "type": "int" + "location": { + "item": { + "contract": "A", + "field": "x", + "kind": "Field", + "reference": { + "contract": "B", + "kind": "SVar", + "svar": "a" + } }, - "value": { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "z" - } + "type": "int" + }, + "value": { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "z" } } ] diff --git a/tests/frontend/pass/staticstore/staticstore.act b/tests/frontend/pass/staticstore/staticstore.act index 8ec7dde0..10500ba9 100644 --- a/tests/frontend/pass/staticstore/staticstore.act +++ b/tests/frontend/pass/staticstore/staticstore.act @@ -5,9 +5,4 @@ iff in range uint256 x + y -storage - - x - y - returns x + y diff --git a/tests/frontend/pass/staticstore/staticstore.act.parsed.hs b/tests/frontend/pass/staticstore/staticstore.act.parsed.hs index b8fffb3d..4daf29ea 100644 --- a/tests/frontend/pass/staticstore/staticstore.act.parsed.hs +++ b/tests/frontend/pass/staticstore/staticstore.act.parsed.hs @@ -1 +1 @@ -Main [Contract (Definition (AlexPn 0 0 0) "C" constructor() [] (Creates []) [] []) [Transition (AlexPn 0 1 1) "f" "C" f() [IffIn (AlexPn 32 4 1) uint256 [EAdd (AlexPn 60 6 7) (EUTEntry (EVar (AlexPn 58 6 5) "x")) (EUTEntry (EVar (AlexPn 62 6 9) "y"))]] (Direct (Post [Constant (EVar (AlexPn 78 10 5) "x"),Constant (EVar (AlexPn 85 11 5) "y")] (Just (EAdd (AlexPn 98 13 11) (EUTEntry (EVar (AlexPn 96 13 9) "x")) (EUTEntry (EVar (AlexPn 100 13 13) "y")))))) []]] +Main [Contract (Definition (AlexPn 0 0 0) "C" constructor() [] (Creates []) [] []) [Transition (AlexPn 0 1 1) "f" "C" f() [IffIn (AlexPn 32 4 1) uint256 [EAdd (AlexPn 60 6 7) (EUTEntry (EVar (AlexPn 58 6 5) "x")) (EUTEntry (EVar (AlexPn 62 6 9) "y"))]] (Direct (Post [] (Just (EAdd (AlexPn 75 8 11) (EUTEntry (EVar (AlexPn 73 8 9) "x")) (EUTEntry (EVar (AlexPn 77 8 13) "y")))))) []]] diff --git a/tests/frontend/pass/token/transfer.act b/tests/frontend/pass/token/transfer.act index 9f655cce..d41e2726 100644 --- a/tests/frontend/pass/token/transfer.act +++ b/tests/frontend/pass/token/transfer.act @@ -36,11 +36,6 @@ case CALLER =/= to: case CALLER == to: - storage - - balanceOf[CALLER] - balanceOf[to] - returns 1 @@ -58,8 +53,6 @@ case src =/= dst and CALLER == src: storage - balanceOf[CALLER] - allowance[src][CALLER] balanceOf[src] => balanceOf[src] - amount balanceOf[dst] => balanceOf[dst] + amount @@ -69,8 +62,6 @@ case src =/= dst and CALLER =/= src and allowance[src][CALLER] == 2^256 - 1: storage - balanceOf[CALLER] - allowance[src][CALLER] balanceOf[src] => balanceOf[src] - amount balanceOf[dst] => balanceOf[dst] + amount @@ -80,7 +71,6 @@ case src =/= dst and CALLER =/= src and allowance[src][CALLER] < 2^256 - 1: storage - balanceOf[CALLER] allowance[src][CALLER] => allowance[src][CALLER] - amount balanceOf[src] => balanceOf[src] - amount balanceOf[dst] => balanceOf[dst] + amount @@ -89,11 +79,5 @@ case src =/= dst and CALLER =/= src and allowance[src][CALLER] < 2^256 - 1: case src == dst: - storage - - balanceOf[CALLER] - allowance[src][CALLER] - balanceOf[src] - balanceOf[dst] returns 1 diff --git a/tests/frontend/pass/token/transfer.act.parsed.hs b/tests/frontend/pass/token/transfer.act.parsed.hs index 4ce0509a..4335cc8c 100644 --- a/tests/frontend/pass/token/transfer.act.parsed.hs +++ b/tests/frontend/pass/token/transfer.act.parsed.hs @@ -1 +1 @@ -Main [Contract (Definition (AlexPn 15 1 16) "Token" constructor(string _symbol, string _name, string _version, uint256 _totalSupply) [] (Creates [AssignVal (StorageVar (AlexPn 128 6 10) string "name") (EUTEntry (EVar (AlexPn 144 6 26) "_name")),AssignVal (StorageVar (AlexPn 159 7 10) string "symbol") (EUTEntry (EVar (AlexPn 175 7 26) "_symbol")),AssignVal (StorageVar (AlexPn 193 8 11) uint256 "totalSupply") (EUTEntry (EVar (AlexPn 208 8 26) "_totalSupply")),AssignMany (StorageVar (AlexPn 248 9 28) mapping(address => uint256) "balanceOf") [Defn (EnvExp (AlexPn 263 9 43) Caller) (EUTEntry (EVar (AlexPn 273 9 53) "_totalSupply"))],AssignMany (StorageVar (AlexPn 330 10 44) mapping(address => mapping(address => uint256)) "allowance") []]) [] [EEq (AlexPn 373 14 15) (EUTEntry (EVar (AlexPn 361 14 3) "totalSupply")) (EUTEntry (EVar (AlexPn 376 14 18) "_totalSupply")),EEq (AlexPn 396 15 8) (EUTEntry (EVar (AlexPn 391 15 3) "name")) (EUTEntry (EVar (AlexPn 399 15 11) "_name")),EEq (AlexPn 414 16 10) (EUTEntry (EVar (AlexPn 407 16 3) "symbol")) (EUTEntry (EVar (AlexPn 417 16 13) "_symbol"))]) [Transition (AlexPn 427 19 1) "transfer" "Token" transfer(uint256 value, address to) [Iff (AlexPn 502 22 1) [EEq (AlexPn 519 24 13) (EnvExp (AlexPn 509 24 3) Callvalue) (IntLit (AlexPn 522 24 16) 0),ELEQ (AlexPn 532 25 9) (EUTEntry (EVar (AlexPn 526 25 3) "value")) (EUTEntry (EMapping (AlexPn 544 25 21) (EVar (AlexPn 535 25 12) "balanceOf") [EnvExp (AlexPn 545 25 22) Caller])),EImpl (AlexPn 569 26 17) (ENeq (AlexPn 562 26 10) (EnvExp (AlexPn 555 26 3) Caller) (EUTEntry (EVar (AlexPn 566 26 14) "to"))) (ELT (AlexPn 594 26 42) (EAdd (AlexPn 586 26 34) (EUTEntry (EMapping (AlexPn 581 26 29) (EVar (AlexPn 572 26 20) "balanceOf") [EUTEntry (EVar (AlexPn 582 26 30) "to")])) (EUTEntry (EVar (AlexPn 588 26 36) "value"))) (EExp (AlexPn 597 26 45) (IntLit (AlexPn 596 26 44) 2) (IntLit (AlexPn 598 26 46) 256)))]] (Branches [Case (AlexPn 603 28 1) (ENeq (AlexPn 615 28 13) (EnvExp (AlexPn 608 28 6) Caller) (EUTEntry (EVar (AlexPn 619 28 17) "to"))) (Post [Rewrite (EMapping (AlexPn 649 32 15) (EVar (AlexPn 640 32 6) "balanceOf") [EnvExp (AlexPn 650 32 16) Caller]) (ESub (AlexPn 679 32 45) (EUTEntry (EMapping (AlexPn 670 32 36) (EVar (AlexPn 661 32 27) "balanceOf") [EnvExp (AlexPn 671 32 37) Caller])) (EUTEntry (EVar (AlexPn 681 32 47) "value"))),Rewrite (EMapping (AlexPn 701 33 15) (EVar (AlexPn 692 33 6) "balanceOf") [EUTEntry (EVar (AlexPn 702 33 16) "to")]) (EAdd (AlexPn 727 33 41) (EUTEntry (EMapping (AlexPn 722 33 36) (EVar (AlexPn 713 33 27) "balanceOf") [EUTEntry (EVar (AlexPn 723 33 37) "to")])) (EUTEntry (EVar (AlexPn 729 33 43) "value")))] (Just (IntLit (AlexPn 746 35 11) 1))),Case (AlexPn 749 37 1) (EEq (AlexPn 761 37 13) (EnvExp (AlexPn 754 37 6) Caller) (EUTEntry (EVar (AlexPn 764 37 16) "to"))) (Post [Constant (EMapping (AlexPn 793 41 14) (EVar (AlexPn 784 41 5) "balanceOf") [EnvExp (AlexPn 794 41 15) Caller]),Constant (EMapping (AlexPn 815 42 14) (EVar (AlexPn 806 42 5) "balanceOf") [EUTEntry (EVar (AlexPn 816 42 15) "to")])] (Just (IntLit (AlexPn 831 44 11) 1)))]) [],Transition (AlexPn 835 47 1) "transferFrom" "Token" transferFrom(address src, address dst, uint256 amount) [Iff (AlexPn 930 50 1) [ELEQ (AlexPn 944 52 10) (EUTEntry (EVar (AlexPn 937 52 3) "amount")) (EUTEntry (EMapping (AlexPn 956 52 22) (EVar (AlexPn 947 52 13) "balanceOf") [EnvExp (AlexPn 957 52 23) Caller])),EImpl (AlexPn 982 53 18) (ENeq (AlexPn 974 53 10) (EUTEntry (EVar (AlexPn 967 53 3) "src")) (EUTEntry (EVar (AlexPn 978 53 14) "dst"))) (ELT (AlexPn 1009 53 45) (EAdd (AlexPn 1000 53 36) (EUTEntry (EMapping (AlexPn 994 53 30) (EVar (AlexPn 985 53 21) "balanceOf") [EUTEntry (EVar (AlexPn 995 53 31) "dst")])) (EUTEntry (EVar (AlexPn 1002 53 38) "amount"))) (EExp (AlexPn 1012 53 48) (IntLit (AlexPn 1011 53 47) 2) (IntLit (AlexPn 1013 53 49) 256))),EImpl (AlexPn 1034 54 18) (ENeq (AlexPn 1026 54 10) (EnvExp (AlexPn 1019 54 3) Caller) (EUTEntry (EVar (AlexPn 1030 54 14) "src"))) (ELEQ (AlexPn 1039 54 23) (IntLit (AlexPn 1037 54 21) 0) (ESub (AlexPn 1065 54 49) (EUTEntry (EMapping (AlexPn 1051 54 35) (EVar (AlexPn 1042 54 26) "allowance") [EUTEntry (EVar (AlexPn 1052 54 36) "src"),EnvExp (AlexPn 1057 54 41) Caller])) (EUTEntry (EVar (AlexPn 1067 54 51) "amount")))),EEq (AlexPn 1086 55 13) (EnvExp (AlexPn 1076 55 3) Callvalue) (IntLit (AlexPn 1089 55 16) 0)]] (Branches [Case (AlexPn 1092 57 1) (EAnd (AlexPn 1109 57 18) (ENeq (AlexPn 1101 57 10) (EUTEntry (EVar (AlexPn 1097 57 6) "src")) (EUTEntry (EVar (AlexPn 1105 57 14) "dst"))) (EEq (AlexPn 1120 57 29) (EnvExp (AlexPn 1113 57 22) Caller) (EUTEntry (EVar (AlexPn 1123 57 32) "src")))) (Post [Constant (EMapping (AlexPn 1154 61 15) (EVar (AlexPn 1145 61 6) "balanceOf") [EnvExp (AlexPn 1155 61 16) Caller]),Constant (EMapping (AlexPn 1177 62 15) (EVar (AlexPn 1168 62 6) "allowance") [EUTEntry (EVar (AlexPn 1178 62 16) "src"),EnvExp (AlexPn 1183 62 21) Caller]),Rewrite (EMapping (AlexPn 1205 63 15) (EVar (AlexPn 1196 63 6) "balanceOf") [EUTEntry (EVar (AlexPn 1206 63 16) "src")]) (ESub (AlexPn 1229 63 39) (EUTEntry (EMapping (AlexPn 1223 63 33) (EVar (AlexPn 1214 63 24) "balanceOf") [EUTEntry (EVar (AlexPn 1224 63 34) "src")])) (EUTEntry (EVar (AlexPn 1231 63 41) "amount"))),Rewrite (EMapping (AlexPn 1252 64 15) (EVar (AlexPn 1243 64 6) "balanceOf") [EUTEntry (EVar (AlexPn 1253 64 16) "dst")]) (EAdd (AlexPn 1276 64 39) (EUTEntry (EMapping (AlexPn 1270 64 33) (EVar (AlexPn 1261 64 24) "balanceOf") [EUTEntry (EVar (AlexPn 1271 64 34) "dst")])) (EUTEntry (EVar (AlexPn 1278 64 41) "amount")))] (Just (IntLit (AlexPn 1296 66 11) 1))),Case (AlexPn 1299 68 1) (EAnd (AlexPn 1335 68 37) (EAnd (AlexPn 1316 68 18) (ENeq (AlexPn 1308 68 10) (EUTEntry (EVar (AlexPn 1304 68 6) "src")) (EUTEntry (EVar (AlexPn 1312 68 14) "dst"))) (ENeq (AlexPn 1327 68 29) (EnvExp (AlexPn 1320 68 22) Caller) (EUTEntry (EVar (AlexPn 1331 68 33) "src")))) (EEq (AlexPn 1362 68 64) (EUTEntry (EMapping (AlexPn 1348 68 50) (EVar (AlexPn 1339 68 41) "allowance") [EUTEntry (EVar (AlexPn 1349 68 51) "src"),EnvExp (AlexPn 1354 68 56) Caller])) (ESub (AlexPn 1371 68 73) (EExp (AlexPn 1366 68 68) (IntLit (AlexPn 1365 68 67) 2) (IntLit (AlexPn 1367 68 69) 256)) (IntLit (AlexPn 1373 68 75) 1)))) (Post [Constant (EMapping (AlexPn 1402 72 15) (EVar (AlexPn 1393 72 6) "balanceOf") [EnvExp (AlexPn 1403 72 16) Caller]),Constant (EMapping (AlexPn 1425 73 15) (EVar (AlexPn 1416 73 6) "allowance") [EUTEntry (EVar (AlexPn 1426 73 16) "src"),EnvExp (AlexPn 1431 73 21) Caller]),Rewrite (EMapping (AlexPn 1453 74 15) (EVar (AlexPn 1444 74 6) "balanceOf") [EUTEntry (EVar (AlexPn 1454 74 16) "src")]) (ESub (AlexPn 1477 74 39) (EUTEntry (EMapping (AlexPn 1471 74 33) (EVar (AlexPn 1462 74 24) "balanceOf") [EUTEntry (EVar (AlexPn 1472 74 34) "src")])) (EUTEntry (EVar (AlexPn 1479 74 41) "amount"))),Rewrite (EMapping (AlexPn 1500 75 15) (EVar (AlexPn 1491 75 6) "balanceOf") [EUTEntry (EVar (AlexPn 1501 75 16) "dst")]) (EAdd (AlexPn 1524 75 39) (EUTEntry (EMapping (AlexPn 1518 75 33) (EVar (AlexPn 1509 75 24) "balanceOf") [EUTEntry (EVar (AlexPn 1519 75 34) "dst")])) (EUTEntry (EVar (AlexPn 1526 75 41) "amount")))] (Just (IntLit (AlexPn 1544 77 11) 1))),Case (AlexPn 1547 79 1) (EAnd (AlexPn 1583 79 37) (EAnd (AlexPn 1564 79 18) (ENeq (AlexPn 1556 79 10) (EUTEntry (EVar (AlexPn 1552 79 6) "src")) (EUTEntry (EVar (AlexPn 1560 79 14) "dst"))) (ENeq (AlexPn 1575 79 29) (EnvExp (AlexPn 1568 79 22) Caller) (EUTEntry (EVar (AlexPn 1579 79 33) "src")))) (ELT (AlexPn 1610 79 64) (EUTEntry (EMapping (AlexPn 1596 79 50) (EVar (AlexPn 1587 79 41) "allowance") [EUTEntry (EVar (AlexPn 1597 79 51) "src"),EnvExp (AlexPn 1602 79 56) Caller])) (ESub (AlexPn 1618 79 72) (EExp (AlexPn 1613 79 67) (IntLit (AlexPn 1612 79 66) 2) (IntLit (AlexPn 1614 79 68) 256)) (IntLit (AlexPn 1620 79 74) 1)))) (Post [Constant (EMapping (AlexPn 1648 83 14) (EVar (AlexPn 1639 83 5) "balanceOf") [EnvExp (AlexPn 1649 83 15) Caller]),Rewrite (EMapping (AlexPn 1670 84 14) (EVar (AlexPn 1661 84 5) "allowance") [EUTEntry (EVar (AlexPn 1671 84 15) "src"),EnvExp (AlexPn 1676 84 20) Caller]) (ESub (AlexPn 1710 84 54) (EUTEntry (EMapping (AlexPn 1696 84 40) (EVar (AlexPn 1687 84 31) "allowance") [EUTEntry (EVar (AlexPn 1697 84 41) "src"),EnvExp (AlexPn 1702 84 46) Caller])) (EUTEntry (EVar (AlexPn 1712 84 56) "amount"))),Rewrite (EMapping (AlexPn 1732 85 14) (EVar (AlexPn 1723 85 5) "balanceOf") [EUTEntry (EVar (AlexPn 1733 85 15) "src")]) (ESub (AlexPn 1764 85 46) (EUTEntry (EMapping (AlexPn 1758 85 40) (EVar (AlexPn 1749 85 31) "balanceOf") [EUTEntry (EVar (AlexPn 1759 85 41) "src")])) (EUTEntry (EVar (AlexPn 1766 85 48) "amount"))),Rewrite (EMapping (AlexPn 1786 86 14) (EVar (AlexPn 1777 86 5) "balanceOf") [EUTEntry (EVar (AlexPn 1787 86 15) "dst")]) (EAdd (AlexPn 1818 86 46) (EUTEntry (EMapping (AlexPn 1812 86 40) (EVar (AlexPn 1803 86 31) "balanceOf") [EUTEntry (EVar (AlexPn 1813 86 41) "dst")])) (EUTEntry (EVar (AlexPn 1820 86 48) "amount")))] (Just (IntLit (AlexPn 1838 88 11) 1))),Case (AlexPn 1841 90 1) (EEq (AlexPn 1850 90 10) (EUTEntry (EVar (AlexPn 1846 90 6) "src")) (EUTEntry (EVar (AlexPn 1853 90 13) "dst"))) (Post [Constant (EMapping (AlexPn 1884 94 15) (EVar (AlexPn 1875 94 6) "balanceOf") [EnvExp (AlexPn 1885 94 16) Caller]),Constant (EMapping (AlexPn 1907 95 15) (EVar (AlexPn 1898 95 6) "allowance") [EUTEntry (EVar (AlexPn 1908 95 16) "src"),EnvExp (AlexPn 1913 95 21) Caller]),Constant (EMapping (AlexPn 1935 96 15) (EVar (AlexPn 1926 96 6) "balanceOf") [EUTEntry (EVar (AlexPn 1936 96 16) "src")]),Constant (EMapping (AlexPn 1955 97 15) (EVar (AlexPn 1946 97 6) "balanceOf") [EUTEntry (EVar (AlexPn 1956 97 16) "dst")])] (Just (IntLit (AlexPn 1972 99 11) 1)))]) []]] +Main [Contract (Definition (AlexPn 15 1 16) "Token" constructor(string _symbol, string _name, string _version, uint256 _totalSupply) [] (Creates [AssignVal (StorageVar (AlexPn 128 6 10) string "name") (EUTEntry (EVar (AlexPn 144 6 26) "_name")),AssignVal (StorageVar (AlexPn 159 7 10) string "symbol") (EUTEntry (EVar (AlexPn 175 7 26) "_symbol")),AssignVal (StorageVar (AlexPn 193 8 11) uint256 "totalSupply") (EUTEntry (EVar (AlexPn 208 8 26) "_totalSupply")),AssignMany (StorageVar (AlexPn 248 9 28) mapping(address => uint256) "balanceOf") [Defn (EnvExp (AlexPn 263 9 43) Caller) (EUTEntry (EVar (AlexPn 273 9 53) "_totalSupply"))],AssignMany (StorageVar (AlexPn 330 10 44) mapping(address => mapping(address => uint256)) "allowance") []]) [] [EEq (AlexPn 373 14 15) (EUTEntry (EVar (AlexPn 361 14 3) "totalSupply")) (EUTEntry (EVar (AlexPn 376 14 18) "_totalSupply")),EEq (AlexPn 396 15 8) (EUTEntry (EVar (AlexPn 391 15 3) "name")) (EUTEntry (EVar (AlexPn 399 15 11) "_name")),EEq (AlexPn 414 16 10) (EUTEntry (EVar (AlexPn 407 16 3) "symbol")) (EUTEntry (EVar (AlexPn 417 16 13) "_symbol"))]) [Transition (AlexPn 427 19 1) "transfer" "Token" transfer(uint256 value, address to) [Iff (AlexPn 502 22 1) [EEq (AlexPn 519 24 13) (EnvExp (AlexPn 509 24 3) Callvalue) (IntLit (AlexPn 522 24 16) 0),ELEQ (AlexPn 532 25 9) (EUTEntry (EVar (AlexPn 526 25 3) "value")) (EUTEntry (EMapping (AlexPn 544 25 21) (EVar (AlexPn 535 25 12) "balanceOf") [EnvExp (AlexPn 545 25 22) Caller])),EImpl (AlexPn 569 26 17) (ENeq (AlexPn 562 26 10) (EnvExp (AlexPn 555 26 3) Caller) (EUTEntry (EVar (AlexPn 566 26 14) "to"))) (ELT (AlexPn 594 26 42) (EAdd (AlexPn 586 26 34) (EUTEntry (EMapping (AlexPn 581 26 29) (EVar (AlexPn 572 26 20) "balanceOf") [EUTEntry (EVar (AlexPn 582 26 30) "to")])) (EUTEntry (EVar (AlexPn 588 26 36) "value"))) (EExp (AlexPn 597 26 45) (IntLit (AlexPn 596 26 44) 2) (IntLit (AlexPn 598 26 46) 256)))]] (Branches [Case (AlexPn 603 28 1) (ENeq (AlexPn 615 28 13) (EnvExp (AlexPn 608 28 6) Caller) (EUTEntry (EVar (AlexPn 619 28 17) "to"))) (Post [Rewrite (EMapping (AlexPn 649 32 15) (EVar (AlexPn 640 32 6) "balanceOf") [EnvExp (AlexPn 650 32 16) Caller]) (ESub (AlexPn 679 32 45) (EUTEntry (EMapping (AlexPn 670 32 36) (EVar (AlexPn 661 32 27) "balanceOf") [EnvExp (AlexPn 671 32 37) Caller])) (EUTEntry (EVar (AlexPn 681 32 47) "value"))),Rewrite (EMapping (AlexPn 701 33 15) (EVar (AlexPn 692 33 6) "balanceOf") [EUTEntry (EVar (AlexPn 702 33 16) "to")]) (EAdd (AlexPn 727 33 41) (EUTEntry (EMapping (AlexPn 722 33 36) (EVar (AlexPn 713 33 27) "balanceOf") [EUTEntry (EVar (AlexPn 723 33 37) "to")])) (EUTEntry (EVar (AlexPn 729 33 43) "value")))] (Just (IntLit (AlexPn 746 35 11) 1))),Case (AlexPn 749 37 1) (EEq (AlexPn 761 37 13) (EnvExp (AlexPn 754 37 6) Caller) (EUTEntry (EVar (AlexPn 764 37 16) "to"))) (Post [] (Just (IntLit (AlexPn 779 39 11) 1)))]) [],Transition (AlexPn 783 42 1) "transferFrom" "Token" transferFrom(address src, address dst, uint256 amount) [Iff (AlexPn 878 45 1) [ELEQ (AlexPn 892 47 10) (EUTEntry (EVar (AlexPn 885 47 3) "amount")) (EUTEntry (EMapping (AlexPn 904 47 22) (EVar (AlexPn 895 47 13) "balanceOf") [EnvExp (AlexPn 905 47 23) Caller])),EImpl (AlexPn 930 48 18) (ENeq (AlexPn 922 48 10) (EUTEntry (EVar (AlexPn 915 48 3) "src")) (EUTEntry (EVar (AlexPn 926 48 14) "dst"))) (ELT (AlexPn 957 48 45) (EAdd (AlexPn 948 48 36) (EUTEntry (EMapping (AlexPn 942 48 30) (EVar (AlexPn 933 48 21) "balanceOf") [EUTEntry (EVar (AlexPn 943 48 31) "dst")])) (EUTEntry (EVar (AlexPn 950 48 38) "amount"))) (EExp (AlexPn 960 48 48) (IntLit (AlexPn 959 48 47) 2) (IntLit (AlexPn 961 48 49) 256))),EImpl (AlexPn 982 49 18) (ENeq (AlexPn 974 49 10) (EnvExp (AlexPn 967 49 3) Caller) (EUTEntry (EVar (AlexPn 978 49 14) "src"))) (ELEQ (AlexPn 987 49 23) (IntLit (AlexPn 985 49 21) 0) (ESub (AlexPn 1013 49 49) (EUTEntry (EMapping (AlexPn 999 49 35) (EVar (AlexPn 990 49 26) "allowance") [EUTEntry (EVar (AlexPn 1000 49 36) "src"),EnvExp (AlexPn 1005 49 41) Caller])) (EUTEntry (EVar (AlexPn 1015 49 51) "amount")))),EEq (AlexPn 1034 50 13) (EnvExp (AlexPn 1024 50 3) Callvalue) (IntLit (AlexPn 1037 50 16) 0)]] (Branches [Case (AlexPn 1040 52 1) (EAnd (AlexPn 1057 52 18) (ENeq (AlexPn 1049 52 10) (EUTEntry (EVar (AlexPn 1045 52 6) "src")) (EUTEntry (EVar (AlexPn 1053 52 14) "dst"))) (EEq (AlexPn 1068 52 29) (EnvExp (AlexPn 1061 52 22) Caller) (EUTEntry (EVar (AlexPn 1071 52 32) "src")))) (Post [Rewrite (EMapping (AlexPn 1102 56 15) (EVar (AlexPn 1093 56 6) "balanceOf") [EUTEntry (EVar (AlexPn 1103 56 16) "src")]) (ESub (AlexPn 1126 56 39) (EUTEntry (EMapping (AlexPn 1120 56 33) (EVar (AlexPn 1111 56 24) "balanceOf") [EUTEntry (EVar (AlexPn 1121 56 34) "src")])) (EUTEntry (EVar (AlexPn 1128 56 41) "amount"))),Rewrite (EMapping (AlexPn 1149 57 15) (EVar (AlexPn 1140 57 6) "balanceOf") [EUTEntry (EVar (AlexPn 1150 57 16) "dst")]) (EAdd (AlexPn 1173 57 39) (EUTEntry (EMapping (AlexPn 1167 57 33) (EVar (AlexPn 1158 57 24) "balanceOf") [EUTEntry (EVar (AlexPn 1168 57 34) "dst")])) (EUTEntry (EVar (AlexPn 1175 57 41) "amount")))] (Just (IntLit (AlexPn 1193 59 11) 1))),Case (AlexPn 1196 61 1) (EAnd (AlexPn 1232 61 37) (EAnd (AlexPn 1213 61 18) (ENeq (AlexPn 1205 61 10) (EUTEntry (EVar (AlexPn 1201 61 6) "src")) (EUTEntry (EVar (AlexPn 1209 61 14) "dst"))) (ENeq (AlexPn 1224 61 29) (EnvExp (AlexPn 1217 61 22) Caller) (EUTEntry (EVar (AlexPn 1228 61 33) "src")))) (EEq (AlexPn 1259 61 64) (EUTEntry (EMapping (AlexPn 1245 61 50) (EVar (AlexPn 1236 61 41) "allowance") [EUTEntry (EVar (AlexPn 1246 61 51) "src"),EnvExp (AlexPn 1251 61 56) Caller])) (ESub (AlexPn 1268 61 73) (EExp (AlexPn 1263 61 68) (IntLit (AlexPn 1262 61 67) 2) (IntLit (AlexPn 1264 61 69) 256)) (IntLit (AlexPn 1270 61 75) 1)))) (Post [Rewrite (EMapping (AlexPn 1299 65 15) (EVar (AlexPn 1290 65 6) "balanceOf") [EUTEntry (EVar (AlexPn 1300 65 16) "src")]) (ESub (AlexPn 1323 65 39) (EUTEntry (EMapping (AlexPn 1317 65 33) (EVar (AlexPn 1308 65 24) "balanceOf") [EUTEntry (EVar (AlexPn 1318 65 34) "src")])) (EUTEntry (EVar (AlexPn 1325 65 41) "amount"))),Rewrite (EMapping (AlexPn 1346 66 15) (EVar (AlexPn 1337 66 6) "balanceOf") [EUTEntry (EVar (AlexPn 1347 66 16) "dst")]) (EAdd (AlexPn 1370 66 39) (EUTEntry (EMapping (AlexPn 1364 66 33) (EVar (AlexPn 1355 66 24) "balanceOf") [EUTEntry (EVar (AlexPn 1365 66 34) "dst")])) (EUTEntry (EVar (AlexPn 1372 66 41) "amount")))] (Just (IntLit (AlexPn 1390 68 11) 1))),Case (AlexPn 1393 70 1) (EAnd (AlexPn 1429 70 37) (EAnd (AlexPn 1410 70 18) (ENeq (AlexPn 1402 70 10) (EUTEntry (EVar (AlexPn 1398 70 6) "src")) (EUTEntry (EVar (AlexPn 1406 70 14) "dst"))) (ENeq (AlexPn 1421 70 29) (EnvExp (AlexPn 1414 70 22) Caller) (EUTEntry (EVar (AlexPn 1425 70 33) "src")))) (ELT (AlexPn 1456 70 64) (EUTEntry (EMapping (AlexPn 1442 70 50) (EVar (AlexPn 1433 70 41) "allowance") [EUTEntry (EVar (AlexPn 1443 70 51) "src"),EnvExp (AlexPn 1448 70 56) Caller])) (ESub (AlexPn 1464 70 72) (EExp (AlexPn 1459 70 67) (IntLit (AlexPn 1458 70 66) 2) (IntLit (AlexPn 1460 70 68) 256)) (IntLit (AlexPn 1466 70 74) 1)))) (Post [Rewrite (EMapping (AlexPn 1494 74 14) (EVar (AlexPn 1485 74 5) "allowance") [EUTEntry (EVar (AlexPn 1495 74 15) "src"),EnvExp (AlexPn 1500 74 20) Caller]) (ESub (AlexPn 1534 74 54) (EUTEntry (EMapping (AlexPn 1520 74 40) (EVar (AlexPn 1511 74 31) "allowance") [EUTEntry (EVar (AlexPn 1521 74 41) "src"),EnvExp (AlexPn 1526 74 46) Caller])) (EUTEntry (EVar (AlexPn 1536 74 56) "amount"))),Rewrite (EMapping (AlexPn 1556 75 14) (EVar (AlexPn 1547 75 5) "balanceOf") [EUTEntry (EVar (AlexPn 1557 75 15) "src")]) (ESub (AlexPn 1588 75 46) (EUTEntry (EMapping (AlexPn 1582 75 40) (EVar (AlexPn 1573 75 31) "balanceOf") [EUTEntry (EVar (AlexPn 1583 75 41) "src")])) (EUTEntry (EVar (AlexPn 1590 75 48) "amount"))),Rewrite (EMapping (AlexPn 1610 76 14) (EVar (AlexPn 1601 76 5) "balanceOf") [EUTEntry (EVar (AlexPn 1611 76 15) "dst")]) (EAdd (AlexPn 1642 76 46) (EUTEntry (EMapping (AlexPn 1636 76 40) (EVar (AlexPn 1627 76 31) "balanceOf") [EUTEntry (EVar (AlexPn 1637 76 41) "dst")])) (EUTEntry (EVar (AlexPn 1644 76 48) "amount")))] (Just (IntLit (AlexPn 1662 78 11) 1))),Case (AlexPn 1665 80 1) (EEq (AlexPn 1674 80 10) (EUTEntry (EVar (AlexPn 1670 80 6) "src")) (EUTEntry (EVar (AlexPn 1677 80 13) "dst"))) (Post [] (Just (IntLit (AlexPn 1694 83 11) 1)))]) []]] diff --git a/tests/frontend/pass/token/transfer.act.typed.json b/tests/frontend/pass/token/transfer.act.typed.json index 7e5582c4..d9f3ff76 100644 --- a/tests/frontend/pass/token/transfer.act.typed.json +++ b/tests/frontend/pass/token/transfer.act.typed.json @@ -420,6 +420,160 @@ "arity": 2, "symbol": "and" }, + { + "args": [ + { + "args": [ + { + "literal": "0", + "type": "int" + }, + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "ethEnv": "Caller", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + } + ], + "arity": 2, + "symbol": "<=" + }, + { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "ethEnv": "Caller", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } + ], + "arity": 2, + "symbol": "<=" + } + ], + "arity": 2, + "symbol": "and" + }, + { + "args": [ + { + "args": [ + { + "literal": "0", + "type": "int" + }, + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + } + ], + "arity": 2, + "symbol": "<=" + }, + { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } + ], + "arity": 2, + "symbol": "<=" + } + ], + "arity": 2, + "symbol": "and" + }, { "args": [ { @@ -499,135 +653,131 @@ }, "stateUpdates": [ { - "rewrite": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", + "location": { + "item": { + "indexes": [ + { + "expression": { + "ethEnv": "Caller", "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "value": { - "args": [ - { - "entry": { - "item": { - "indexes": [ - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", + "type": "int" + }, + "value": { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "ethEnv": "Caller", "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "timing": "Pre" + "type": "int" }, - { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "value" - } - ], - "arity": 2, - "symbol": "-" - } + "timing": "Pre" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "value" + } + ], + "arity": 2, + "symbol": "-" } }, { - "rewrite": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "to" + "location": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "value": { - "args": [ - { - "entry": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "to" + "type": "int" + }, + "value": { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "to" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" - }, - "timing": "Pre" - }, - { - "abitype": { - "size": "256", - "type": "UInt" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "type": "int", - "var": "value" - } - ], - "arity": 2, - "symbol": "+" - } + "type": "int" + }, + "timing": "Pre" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "value" + } + ], + "arity": 2, + "symbol": "+" } } ] @@ -1127,61 +1277,7 @@ "kind": "TypedExpr", "type": "int" }, - "stateUpdates": [ - { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - } - } - }, - { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "to" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - } - } - } - ] + "stateUpdates": [] }, { "case": [ @@ -1619,8 +1715,11 @@ "indexes": [ { "expression": { - "ethEnv": "Caller", - "type": "int" + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" }, "kind": "TypedExpr", "type": "int" @@ -1649,8 +1748,11 @@ "indexes": [ { "expression": { - "ethEnv": "Caller", - "type": "int" + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" }, "kind": "TypedExpr", "type": "int" @@ -1697,15 +1799,7 @@ "type": "Address" }, "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" + "var": "dst" }, "kind": "TypedExpr", "type": "int" @@ -1715,7 +1809,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "allowance" + "svar": "balanceOf" } }, "type": "int" @@ -1738,11 +1832,47 @@ "type": "Address" }, "type": "int", - "var": "src" + "var": "dst" }, "kind": "TypedExpr", "type": "int" - }, + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } + ], + "arity": 2, + "symbol": "<=" + } + ], + "arity": 2, + "symbol": "and" + }, + { + "args": [ + { + "args": [ + { + "literal": "0", + "type": "int" + }, + { + "entry": { + "item": { + "indexes": [ { "expression": { "ethEnv": "Caller", @@ -1756,7 +1886,37 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "allowance" + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + } + ], + "arity": 2, + "symbol": "<=" + }, + { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "ethEnv": "Caller", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" } }, "type": "int" @@ -1793,7 +1953,7 @@ "type": "Address" }, "type": "int", - "var": "src" + "var": "dst" }, "kind": "TypedExpr", "type": "int" @@ -1826,7 +1986,7 @@ "type": "Address" }, "type": "int", - "var": "src" + "var": "dst" }, "kind": "TypedExpr", "type": "int" @@ -1873,7 +2033,15 @@ "type": "Address" }, "type": "int", - "var": "dst" + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" }, "kind": "TypedExpr", "type": "int" @@ -1883,7 +2051,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -1906,7 +2074,15 @@ "type": "Address" }, "type": "int", - "var": "dst" + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" }, "kind": "TypedExpr", "type": "int" @@ -1916,7 +2092,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -2014,202 +2190,137 @@ }, "stateUpdates": [ { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - } - } - }, - { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "allowance" - } - }, - "type": "int" - } - } - }, - { - "rewrite": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - }, - "value": { - "args": [ - { - "entry": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - }, - "timing": "Pre" - }, + "location": { + "item": { + "indexes": [ { - "abitype": { - "size": "256", - "type": "UInt" + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" }, - "type": "int", - "var": "amount" + "kind": "TypedExpr", + "type": "int" } ], - "arity": 2, - "symbol": "-" - } + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "value": { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "amount" + } + ], + "arity": 2, + "symbol": "-" } }, { - "rewrite": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "dst" + "location": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "value": { - "args": [ - { - "entry": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "dst" + "type": "int" + }, + "value": { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "timing": "Pre" + "type": "int" }, - { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "amount" - } - ], - "arity": 2, - "symbol": "+" - } + "timing": "Pre" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "amount" + } + ], + "arity": 2, + "symbol": "+" } } ] @@ -2692,8 +2803,168 @@ "size": "256", "type": "UInt" }, - "type": "int", - "var": "amount" + "type": "int", + "var": "amount" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } + ], + "arity": 2, + "symbol": "<=" + } + ], + "arity": 2, + "symbol": "and" + }, + { + "args": [ + { + "args": [ + { + "literal": "0", + "type": "int" + }, + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + } + ], + "arity": 2, + "symbol": "<=" + }, + { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } + ], + "arity": 2, + "symbol": "<=" + } + ], + "arity": 2, + "symbol": "and" + }, + { + "args": [ + { + "args": [ + { + "literal": "0", + "type": "int" + }, + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + } + ], + "arity": 2, + "symbol": "<=" + }, + { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" }, { "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", @@ -2799,15 +3070,7 @@ "type": "Address" }, "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" + "var": "dst" }, "kind": "TypedExpr", "type": "int" @@ -2817,7 +3080,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "allowance" + "svar": "balanceOf" } }, "type": "int" @@ -2840,15 +3103,7 @@ "type": "Address" }, "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" + "var": "dst" }, "kind": "TypedExpr", "type": "int" @@ -2858,7 +3113,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "allowance" + "svar": "balanceOf" } }, "type": "int" @@ -2899,13 +3154,21 @@ }, "kind": "TypedExpr", "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" } ], "kind": "Mapping", "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -2932,13 +3195,21 @@ }, "kind": "TypedExpr", "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" } ], "kind": "Mapping", "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -2975,7 +3246,15 @@ "type": "Address" }, "type": "int", - "var": "dst" + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" }, "kind": "TypedExpr", "type": "int" @@ -2985,7 +3264,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -3008,7 +3287,15 @@ "type": "Address" }, "type": "int", - "var": "dst" + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" }, "kind": "TypedExpr", "type": "int" @@ -3018,7 +3305,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -3116,202 +3403,137 @@ }, "stateUpdates": [ { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - } - } - }, - { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" + "location": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" + "type": "int", + "var": "src" }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "allowance" - } - }, - "type": "int" - } - } - }, - { - "rewrite": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "value": { - "args": [ - { - "entry": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" + "type": "int" + }, + "value": { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "timing": "Pre" + "type": "int" }, - { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "amount" - } - ], - "arity": 2, - "symbol": "-" - } + "timing": "Pre" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "amount" + } + ], + "arity": 2, + "symbol": "-" } }, { - "rewrite": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "dst" + "location": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "value": { - "args": [ - { - "entry": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "dst" + "type": "int" + }, + "value": { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "timing": "Pre" + "type": "int" }, - { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "amount" - } - ], - "arity": 2, - "symbol": "+" - } + "timing": "Pre" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "amount" + } + ], + "arity": 2, + "symbol": "+" } } ] @@ -3794,8 +4016,264 @@ "size": "256", "type": "UInt" }, - "type": "int", - "var": "amount" + "type": "int", + "var": "amount" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } + ], + "arity": 2, + "symbol": "<=" + } + ], + "arity": 2, + "symbol": "and" + }, + { + "args": [ + { + "args": [ + { + "literal": "0", + "type": "int" + }, + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } + }, + "type": "int" + }, + "timing": "Pre" + } + ], + "arity": 2, + "symbol": "<=" + }, + { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } + }, + "type": "int" + }, + "timing": "Pre" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } + ], + "arity": 2, + "symbol": "<=" + } + ], + "arity": 2, + "symbol": "and" + }, + { + "args": [ + { + "args": [ + { + "literal": "0", + "type": "int" + }, + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + } + ], + "arity": 2, + "symbol": "<=" + }, + { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + }, + { + "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "type": "int" + } + ], + "arity": 2, + "symbol": "<=" + } + ], + "arity": 2, + "symbol": "and" + }, + { + "args": [ + { + "args": [ + { + "literal": "0", + "type": "int" + }, + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" + } + ], + "arity": 2, + "symbol": "<=" + }, + { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" + }, + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" + } + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } + }, + "type": "int" + }, + "timing": "Pre" }, { "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", @@ -3901,15 +4379,7 @@ "type": "Address" }, "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" + "var": "dst" }, "kind": "TypedExpr", "type": "int" @@ -3919,7 +4389,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "allowance" + "svar": "balanceOf" } }, "type": "int" @@ -3942,15 +4412,7 @@ "type": "Address" }, "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" + "var": "dst" }, "kind": "TypedExpr", "type": "int" @@ -3960,7 +4422,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "allowance" + "svar": "balanceOf" } }, "type": "int" @@ -4001,13 +4463,21 @@ }, "kind": "TypedExpr", "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" } ], "kind": "Mapping", "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -4034,13 +4504,21 @@ }, "kind": "TypedExpr", "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" + }, + "kind": "TypedExpr", + "type": "int" } ], "kind": "Mapping", "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -4077,7 +4555,15 @@ "type": "Address" }, "type": "int", - "var": "dst" + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" }, "kind": "TypedExpr", "type": "int" @@ -4087,7 +4573,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -4110,7 +4596,15 @@ "type": "Address" }, "type": "int", - "var": "dst" + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", + "type": "int" }, "kind": "TypedExpr", "type": "int" @@ -4120,7 +4614,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -4218,251 +4712,220 @@ }, "stateUpdates": [ { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - } - } - }, - { - "rewrite": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" + "location": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" + "type": "int", + "var": "src" }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "allowance" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "value": { - "args": [ - { - "entry": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" + "type": "int" + }, + "value": { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" + "type": "int", + "var": "src" }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", + "kind": "TypedExpr", + "type": "int" + }, + { + "expression": { + "ethEnv": "Caller", "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "allowance" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "allowance" + } }, - "timing": "Pre" + "type": "int" }, - { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "amount" - } - ], - "arity": 2, - "symbol": "-" - } + "timing": "Pre" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "amount" + } + ], + "arity": 2, + "symbol": "-" } }, { - "rewrite": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" + "location": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "value": { - "args": [ - { - "entry": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" + "type": "int" + }, + "value": { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "src" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "timing": "Pre" + "type": "int" }, - { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "amount" - } - ], - "arity": 2, - "symbol": "-" - } + "timing": "Pre" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "amount" + } + ], + "arity": 2, + "symbol": "-" } }, { - "rewrite": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "dst" + "location": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "value": { - "args": [ - { - "entry": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "dst" + "type": "int" + }, + "value": { + "args": [ + { + "entry": { + "item": { + "indexes": [ + { + "expression": { + "abitype": { + "type": "Address" }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" + "type": "int", + "var": "dst" + }, + "kind": "TypedExpr", + "type": "int" } - }, - "type": "int" + ], + "kind": "Mapping", + "reference": { + "contract": "Token", + "kind": "SVar", + "svar": "balanceOf" + } }, - "timing": "Pre" + "type": "int" }, - { - "abitype": { - "size": "256", - "type": "UInt" - }, - "type": "int", - "var": "amount" - } - ], - "arity": 2, - "symbol": "+" - } + "timing": "Pre" + }, + { + "abitype": { + "size": "256", + "type": "UInt" + }, + "type": "int", + "var": "amount" + } + ], + "arity": 2, + "symbol": "+" } } ] @@ -4958,15 +5421,7 @@ "type": "Address" }, "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" + "var": "dst" }, "kind": "TypedExpr", "type": "int" @@ -4976,7 +5431,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "allowance" + "svar": "balanceOf" } }, "type": "int" @@ -4999,15 +5454,7 @@ "type": "Address" }, "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" + "var": "dst" }, "kind": "TypedExpr", "type": "int" @@ -5017,7 +5464,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "allowance" + "svar": "balanceOf" } }, "type": "int" @@ -5058,36 +5505,11 @@ }, "kind": "TypedExpr", "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - }, - "timing": "Pre" - } - ], - "arity": 2, - "symbol": "<=" - }, - { - "args": [ - { - "entry": { - "item": { - "indexes": [ + }, { "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" + "ethEnv": "Caller", + "type": "int" }, "kind": "TypedExpr", "type": "int" @@ -5097,33 +5519,19 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" }, "timing": "Pre" - }, - { - "literal": "115792089237316195423570985008687907853269984665640564039457584007913129639935", - "type": "int" } ], "arity": 2, "symbol": "<=" - } - ], - "arity": 2, - "symbol": "and" - }, - { - "args": [ + }, { "args": [ - { - "literal": "0", - "type": "int" - }, { "entry": { "item": { @@ -5134,40 +5542,15 @@ "type": "Address" }, "type": "int", - "var": "dst" + "var": "src" }, "kind": "TypedExpr", "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - }, - "timing": "Pre" - } - ], - "arity": 2, - "symbol": "<=" - }, - { - "args": [ - { - "entry": { - "item": { - "indexes": [ + }, { "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "dst" + "ethEnv": "Caller", + "type": "int" }, "kind": "TypedExpr", "type": "int" @@ -5177,7 +5560,7 @@ "reference": { "contract": "Token", "kind": "SVar", - "svar": "balanceOf" + "svar": "allowance" } }, "type": "int" @@ -5273,125 +5656,7 @@ "kind": "TypedExpr", "type": "int" }, - "stateUpdates": [ - { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - } - } - }, - { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - }, - { - "expression": { - "ethEnv": "Caller", - "type": "int" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "allowance" - } - }, - "type": "int" - } - } - }, - { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "src" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - } - } - }, - { - "constant": { - "location": { - "item": { - "indexes": [ - { - "expression": { - "abitype": { - "type": "Address" - }, - "type": "int", - "var": "dst" - }, - "kind": "TypedExpr", - "type": "int" - } - ], - "kind": "Mapping", - "reference": { - "contract": "Token", - "kind": "SVar", - "svar": "balanceOf" - } - }, - "type": "int" - } - } - } - ] + "stateUpdates": [] } ], "constructor": {