Skip to content

Commit

Permalink
fix(fee): default gas and storage limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Awea committed Jun 10, 2024
1 parent 10c1455 commit d93b152
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/rpc.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@ defmodule Tezex.Rpc do

@spec prepare_operation(list(op()), nonempty_binary(), integer(), nonempty_binary()) :: op()
def prepare_operation(contents, wallet_address, counter, branch) do
hard_gas_limit_per_content = div(1_040_000, length(contents))
hard_storage_limit_per_content = div(60000, length(contents))

contents =
contents
|> Enum.with_index(counter)
|> Enum.map(fn {content, counter} ->
gas_limit = min(hard_gas_limit_per_content, Fee.default_gas_limit(content))
storage_limit = min(hard_storage_limit_per_content, Fee.default_storage_limit(content))

Map.merge(content, %{
"counter" => Integer.to_string(counter),
"source" => wallet_address,
"gas_limit" => Integer.to_string(Fee.default_gas_limit(content)),
"storage_limit" => Integer.to_string(Fee.default_storage_limit(content)),
"gas_limit" => Integer.to_string(gas_limit),
"storage_limit" => Integer.to_string(storage_limit),
"fee" => "0"
})
end)
Expand Down

0 comments on commit d93b152

Please sign in to comment.