diff --git a/src/aeso_compiler.erl b/src/aeso_compiler.erl index 18f6bb3..dbcfa0c 100644 --- a/src/aeso_compiler.erl +++ b/src/aeso_compiler.erl @@ -111,10 +111,18 @@ from_string1(aevm, ContractString, Options) -> type_info => TypeInfo }}; from_string1(fate, ContractString, Options) -> - Ast = parse(ContractString, Options), - TypedAst = aeso_ast_infer_types:infer(Ast, Options), - FCode = aeso_ast_to_fcode:ast_to_fcode(TypedAst, Options), - {ok, aeso_fcode_to_fate:compile(FCode, Options)}. + Ast = parse(ContractString, Options), + TypedAst = aeso_ast_infer_types:infer(Ast, Options), + FCode = aeso_ast_to_fcode:ast_to_fcode(TypedAst, Options), + FateCode = aeso_fcode_to_fate:compile(FCode, Options), + ByteCode = aeb_fate_code:serialize(FateCode, []), + {ok, Version} = version(), + {ok, #{byte_code => ByteCode, + compiler_version => Version, + contract_source => ContractString, + type_info => [], + fate_code => FateCode + }}. -spec string_to_icode(string(), [option()]) -> map(). string_to_icode(ContractString, Options) -> diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index 331e996..dfca755 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -23,7 +23,7 @@ simple_compile_test_() -> contract_source := _, type_info := _} when Backend == aevm -> ?assertMatch(Code when is_binary(Code), ByteCode); - Code when Backend == fate, is_tuple(Code) -> + #{fate_code := Code} when Backend == fate -> Code1 = aeb_fate_code:deserialize(aeb_fate_code:serialize(Code)), ?assertMatch({X, X}, {Code1, Code}); ErrBin ->