* Call.fee

* nice align
This commit is contained in:
Radosław Rowicki 2021-05-24 14:30:57 +02:00 committed by GitHub
parent cca7bdff49
commit e8b32a6875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 3 deletions

View File

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Chain.bytecode_hash` - `Chain.bytecode_hash`
- Minor support for variadic functions - Minor support for variadic functions
- `void` type that represents an empty type - `void` type that represents an empty type
- `Call.fee` builtin
### Changed ### Changed
- Contract interfaces must be now invocated by `contract interface` keywords - Contract interfaces must be now invocated by `contract interface` keywords
- `main` keyword to indicate the main contract in case there are child contracts around - `main` keyword to indicate the main contract in case there are child contracts around

View File

@ -2,7 +2,7 @@
{erl_opts, [debug_info]}. {erl_opts, [debug_info]}.
{deps, [ {aebytecode, {git, "https://github.com/aeternity/aebytecode.git", {ref,"951db9f"}}} {deps, [ {aebytecode, {git, "https://github.com/aeternity/aebytecode.git", {ref,"05dfd7f"}}}
, {getopt, "1.0.1"} , {getopt, "1.0.1"}
, {eblake2, "1.0.0"} , {eblake2, "1.0.0"}
, {jsx, {git, "https://github.com/talentdeficit/jsx.git", , {jsx, {git, "https://github.com/talentdeficit/jsx.git",

View File

@ -1,7 +1,7 @@
{"1.1.0", {"1.1.0",
[{<<"aebytecode">>, [{<<"aebytecode">>,
{git,"https://github.com/aeternity/aebytecode.git", {git,"https://github.com/aeternity/aebytecode.git",
{ref,"951db9f38412a1f798987403d24c512d82fec8c7"}}, {ref,"05dfd7ffc7fb1e07ecc0b1e516da571f56d7dc8f"}},
0}, 0},
{<<"aeserialization">>, {<<"aeserialization">>,
{git,"https://github.com/aeternity/aeserialization.git", {git,"https://github.com/aeternity/aeserialization.git",

View File

@ -561,6 +561,7 @@ global_env() ->
{"caller", Address}, {"caller", Address},
{"value", Int}, {"value", Int},
{"gas_price", Int}, {"gas_price", Int},
{"fee", Int},
{"gas_left", Fun([], Int)}]) {"gas_left", Fun([], Int)}])
}, },

View File

@ -246,7 +246,7 @@ builtins() ->
{"timestamp", none}, {"block_height", none}, {"difficulty", none}, {"timestamp", none}, {"block_height", none}, {"difficulty", none},
{"gas_limit", none}, {"bytecode_hash", 1}, {"create", variable}, {"clone", variable}]}, {"gas_limit", none}, {"bytecode_hash", 1}, {"create", variable}, {"clone", variable}]},
{["Contract"], [{"address", none}, {"balance", none}, {"creator", none}]}, {["Contract"], [{"address", none}, {"balance", none}, {"creator", none}]},
{["Call"], [{"origin", none}, {"caller", none}, {"value", none}, {"gas_price", none}, {["Call"], [{"origin", none}, {"caller", none}, {"value", none}, {"gas_price", none}, {"fee", none},
{"gas_left", 0}]}, {"gas_left", 0}]},
{["Oracle"], [{"register", 4}, {"expiry", 1}, {"query_fee", 1}, {"query", 5}, {"get_question", 2}, {["Oracle"], [{"register", 4}, {"expiry", 1}, {"query_fee", 1}, {"query", 5}, {"get_question", 2},
{"respond", 4}, {"extend", 3}, {"get_answer", 2}, {"respond", 4}, {"extend", 3}, {"get_answer", 2},

View File

@ -527,6 +527,8 @@ builtin_to_scode(_Env, call_value, []) ->
[aeb_fate_ops:call_value(?a)]; [aeb_fate_ops:call_value(?a)];
builtin_to_scode(_Env, call_gas_price, []) -> builtin_to_scode(_Env, call_gas_price, []) ->
[aeb_fate_ops:gasprice(?a)]; [aeb_fate_ops:gasprice(?a)];
builtin_to_scode(_Env, call_fee, []) ->
[aeb_fate_ops:fee(?a)];
builtin_to_scode(_Env, call_gas_left, []) -> builtin_to_scode(_Env, call_gas_left, []) ->
[aeb_fate_ops:gas(?a)]; [aeb_fate_ops:gas(?a)];
builtin_to_scode(Env, oracle_register, [_Sign,_Account,_QFee,_TTL,_QType,_RType] = Args) -> builtin_to_scode(Env, oracle_register, [_Sign,_Account,_QFee,_TTL,_QType,_RType] = Args) ->
@ -925,6 +927,7 @@ attributes(I) ->
{'ORIGIN', A} -> Pure(A, []); {'ORIGIN', A} -> Pure(A, []);
{'CALLER', A} -> Pure(A, []); {'CALLER', A} -> Pure(A, []);
{'GASPRICE', A} -> Pure(A, []); {'GASPRICE', A} -> Pure(A, []);
{'FEE', A} -> Pure(A, []);
{'BLOCKHASH', A, B} -> Pure(A, [B]); {'BLOCKHASH', A, B} -> Pure(A, [B]);
{'BENEFICIARY', A} -> Pure(A, []); {'BENEFICIARY', A} -> Pure(A, []);
{'TIMESTAMP', A} -> Pure(A, []); {'TIMESTAMP', A} -> Pure(A, []);

View File

@ -44,6 +44,9 @@ contract Environment =
// Gas price // Gas price
entrypoint call_gas_price() : int = Call.gas_price entrypoint call_gas_price() : int = Call.gas_price
// Fee
entrypoint call_fee() : int = Call.fee
// -- Information about the chain --- // -- Information about the chain ---
// Account balances // Account balances