diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..31cc2ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +.eunit +deps +cancer +*.o +*.beam +*.plt +*.swp +erl_crash.dump +ebin/*.beam +doc/*.html +doc/*.css +doc/edoc-info +doc/erlang.png +rel/example_project +.concrete/DEV_MODE +.rebar diff --git a/ebin/hakuzaru.app b/ebin/hakuzaru.app index 2332c9f..9c10ad5 100644 --- a/ebin/hakuzaru.app +++ b/ebin/hakuzaru.app @@ -3,6 +3,6 @@ {included_applications,[]}, {applications,[stdlib,kernel]}, {description,"Gajumaru interoperation library"}, - {vsn,"0.1.0"}, + {vsn,"0.2.0"}, {modules,[hakuzaru,hz,hz_fetcher,hz_man,hz_sup]}, {mod,{hakuzaru,[]}}]}. diff --git a/ebin/hakuzaru.beam b/ebin/hakuzaru.beam deleted file mode 100644 index 1342f29..0000000 Binary files a/ebin/hakuzaru.beam and /dev/null differ diff --git a/ebin/hz.beam b/ebin/hz.beam deleted file mode 100644 index 90c802e..0000000 Binary files a/ebin/hz.beam and /dev/null differ diff --git a/ebin/hz_fetcher.beam b/ebin/hz_fetcher.beam deleted file mode 100644 index 3cfdbbd..0000000 Binary files a/ebin/hz_fetcher.beam and /dev/null differ diff --git a/ebin/hz_man.beam b/ebin/hz_man.beam deleted file mode 100644 index 51a6794..0000000 Binary files a/ebin/hz_man.beam and /dev/null differ diff --git a/ebin/hz_sup.beam b/ebin/hz_sup.beam deleted file mode 100644 index 213a2da..0000000 Binary files a/ebin/hz_sup.beam and /dev/null differ diff --git a/src/hakuzaru.erl b/src/hakuzaru.erl index 10adf29..e5e4493 100644 --- a/src/hakuzaru.erl +++ b/src/hakuzaru.erl @@ -6,7 +6,7 @@ %%% @end -module(hakuzaru). --vsn("0.4.1"). +-vsn("0.2.0"). -author("Craig Everett "). -copyright("Craig Everett "). -license("GPL-3.0-or-later"). diff --git a/src/hz.erl b/src/hz.erl index 241beaa..57862b2 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -23,7 +23,7 @@ %%% @end -module(hz). --vsn("0.4.1"). +-vsn("0.2.0"). -author("Craig Everett "). -copyright("Craig Everett "). -license("GPL-3.0-or-later"). @@ -61,6 +61,7 @@ min_gas/0, min_gas_price/0, contract_create/3, + contract_create_built/3, contract_create/8, prepare_contract/1, aaci_lookup_spec/2, @@ -1012,36 +1013,54 @@ contract_create(CreatorID, Nonce, Amount, TTL, Gas, GasPrice, Path, InitArgs) -> Error end. + +contract_create_built(CreatorID, Compiled, InitArgs) -> + case next_nonce(CreatorID) of + {ok, Nonce} -> + Amount = 0, + {ok, Height} = top_height(), + TTL = Height + 262980, + Gas = 500000, + GasPrice = min_gas_price(), + contract_create3(CreatorID, Nonce, + Amount, TTL, Gas, GasPrice, + Compiled, InitArgs); + Error -> + Error + end. + + contract_create2(CreatorID, Nonce, Amount, TTL, Gas, GasPrice, Source, Options, InitArgs) -> case aeso_compiler:from_string(Source, Options) of {ok, Compiled} -> contract_create3(CreatorID, Nonce, Amount, TTL, Gas, GasPrice, - Source, Compiled, InitArgs); + Compiled, InitArgs); Error -> Error end. -contract_create3(CreatorID, Nonce, Amount, TTL, Gas, GasPrice, Source, Compiled, InitArgs) -> +contract_create3(CreatorID, Nonce, Amount, TTL, Gas, GasPrice, Compiled, InitArgs) -> AACI = prepare_aaci(maps:get(aci, Compiled)), case encode_call_data(AACI, "init", InitArgs) of {ok, CallData} -> contract_create4(CreatorID, Nonce, Amount, TTL, Gas, GasPrice, - Source, Compiled, CallData); + Compiled, CallData); Error -> Error end. -contract_create4(CreatorID, Nonce, Amount, TTL, Gas, GasPrice, Source, Compiled, CallData) -> +contract_create4(CreatorID, Nonce, Amount, TTL, Gas, GasPrice, Compiled, CallData) -> PK = unicode:characters_to_binary(CreatorID), try {account_pubkey, OwnerID} = aeser_api_encoder:decode(PK), - contract_create5(OwnerID, Nonce, Amount, TTL, Gas, GasPrice, Source, Compiled, CallData) + contract_create5(OwnerID, Nonce, Amount, TTL, Gas, GasPrice, Compiled, CallData) catch Error:Reason -> {Error, Reason} end. -contract_create5(OwnerID, Nonce, Amount, TTL, Gas, GasPrice, Source, Compiled, CallData) -> +contract_create5(OwnerID, Nonce, Amount, TTL, Gas, GasPrice, Compiled, CallData) -> Code = aeser_contract_code:serialize(Compiled), + Source = maps:get(contract_source, Compiled, <<>>), VM = 1, ABI = 1, <> = <>, diff --git a/src/hz_fetcher.erl b/src/hz_fetcher.erl index 159711b..a7803be 100644 --- a/src/hz_fetcher.erl +++ b/src/hz_fetcher.erl @@ -1,5 +1,5 @@ -module(hz_fetcher). --vsn("0.4.1"). +-vsn("0.2.0"). -author("Craig Everett "). -copyright("Craig Everett "). -license("MIT"). diff --git a/src/hz_man.erl b/src/hz_man.erl index 866504e..31f7e66 100644 --- a/src/hz_man.erl +++ b/src/hz_man.erl @@ -9,7 +9,7 @@ %%% @end -module(hz_man). --vsn("0.4.1"). +-vsn("0.2.0"). -behavior(gen_server). -author("Craig Everett "). -copyright("Craig Everett "). diff --git a/src/hz_sup.erl b/src/hz_sup.erl index b3b2ee1..80b1f60 100644 --- a/src/hz_sup.erl +++ b/src/hz_sup.erl @@ -9,7 +9,7 @@ %%% @end -module(hz_sup). --vsn("0.4.1"). +-vsn("0.2.0"). -behaviour(supervisor). -author("Craig Everett "). -copyright("Craig Everett "). diff --git a/zomp.meta b/zomp.meta index 83a5dcb..8363088 100644 --- a/zomp.meta +++ b/zomp.meta @@ -1,10 +1,10 @@ {name,"Hakuzaru"}. {type,app}. {modules,[]}. -{author,"Craig Everett"}. {prefix,"hz"}. {desc,"Gajumaru interoperation library"}. -{package_id,{"otpr","hakuzaru",{0,1,0}}}. +{author,"Craig Everett"}. +{package_id,{"otpr","hakuzaru",{0,2,0}}}. {deps,[{"otpr","erl_base58",{0,1,0}}, {"otpr","ec_utils",{1,0,0}}, {"otpr","aebytecode",{3,2,1}},