From Michelson to LiquidityΒΆ
Here is a table of how Michelson instructions translate to Liquidity:
ADDRESS:Contract.untype cAMOUNT:Current.amount()ABS:match%nat x with Plus n -> | Minus n -> nADD:x + yAND:x land yorx && yorx & yBALANCE:Current.balance()BLAKE2B:Crypto.blake2b bytesCAR:x.(0)CDR:x.(1)CAST: not availableCHECK_SIGNATURE:Crypto.check key sig bytesCOMPARE:compare x yCONCAT:String.concat listorbytes.concat listCONS:x :: yCONTRACTCREATE_ACCOUNT:Account.createCREATE_CONTRACTDIP: automatic stack managementDROP: automatic stack managementDUP: automatic stack managementEDIV:x / yEMPTY_BIG_MAP:BigMap []EMPTY_MAP:Map []EMPTY_SET:Set []EQ:x = yEXEC:x |> forf xorf @@ xFAILWITH:Current.failwithGE:x >= yGET:Map.find key mapGT:x > yHASH_KEY:Crypto.hash_key kIF:if COND_EXPR then EXPR_IF_TRUE else EXPR_IF_FALSEIF_CONS:match list with [] -> EXPR | head :: tail -> EXPRIF_LEFT:match variant with Left x -> EXPR | Right x -> EXPRIF_NONE:match option with None -> EXPR | Some x -> EXPRIMPLICIT_ACCOUNT:Account.defaultINT:int xISNAT:is_nat xormatch%int x with Plus x -> ... | Minus y -> ...ITER:List.iter,Set.iter,Map.iter,List.fold,Map.fold
LAMBDA:fun x -> ...LE:x <= yLEFT:Left xLOOP:Loop.loop (fun x -> ...; (cond, x')) x0LOOP_LEFT:Loop.left (fun (x, acc) -> (Left x/Right res, acc)) x0 accLSL:x lsl yorx << yLSR:x lsr yorx >> yLT:x < yMAP:List.map,Map.map,List.map_fold,Map.map_fold
MEM:Set.mem ele set,Map.mem key mapMUL:x * yNEG:~- xNEQ:x <> yNIL:( [] : int list)NONE:(None : int option)NOT:not xNOW:Current.time ()OR:x lor y, orx || y, orx or yPACK:Bytes.pack xPAIR:( x, y )PUSH,DIP,DROP,DIG,DUG,SWAP: automatic stack managementRENAME: automatic annotations managementRIGHT:Right xSENDER:Current.sender()SIZE:List.size list,String.size,Bytes.size,Set.sizeSELF %e:[%handle Self.e]SET_DELEGATE:Contract.set_delegate (Some keyhash)SHA256:Crypto.sha256 bytesSHA512:Crypto.sha512 bytesSLICE:String.sub pos len stringorBytes.subSOME:Some xSOURCE:Current.source()STEPS_TO_QUOTA:Current.gas()(deprecated, works for decompilation only)SUB:x - yTRANSFER_TOKENS:Contract.call contract amount paramUNIT:()UNPACK:(unpack bytes : int list option)UPDATE:Set.update key true setorMap.update key (Some val) mapXOR:x lxor y