Skip to content

Commit

Permalink
calculate_base_fork_2_7_0
Browse files Browse the repository at this point in the history
  • Loading branch information
HiveProject2021 committed Jan 12, 2024
1 parent 0ad3ed6 commit 5ac0b08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/chivesweave/src/ar_inflation.erl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ calculate_base_fork_2_7_0(Height) ->
* ?WINSTON_PER_AR
* EXDivisor
* Ln2Dividend
* 12
* 10
div (
10
* 10
Expand Down
18 changes: 14 additions & 4 deletions apps/chivesweave/src/ar_tx.erl
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,13 @@ is_tx_fee_sufficient(Args) ->

get_tx_fee(Args) ->
{DataSize, PricePerGiBMinute, KryderPlusRateMultiplier, Addr, Accounts, Height} = Args,
Fork_2_6_8 = ar_fork:height_2_6_8(),
Args2 = {DataSize, PricePerGiBMinute, KryderPlusRateMultiplier, Addr, Accounts, Height},
TransitionStart_2_6_8 = Fork_2_6_8 + ?PRICE_2_6_8_TRANSITION_START,
case Height >= TransitionStart_2_6_8 of
case Height >= ar_fork:height_2_7_0() of
false ->
%% Pre-2.6.8 transition period. Use a static fee-based pricing + new account fee.
get_static_2_6_8_tx_fee(DataSize, Addr, Accounts);
true ->
get_static_2_6_8_tx_fee(DataSize, Addr, Accounts)
get_static_2_7_0_tx_fee(DataSize, Addr, Accounts)
end.

get_static_2_6_8_tx_fee(DataSize, Addr, Accounts) ->
Expand All @@ -577,6 +575,18 @@ get_static_2_6_8_tx_fee(DataSize, Addr, Accounts) ->
UploadFee + NewAccountFee
end.


get_static_2_7_0_tx_fee(DataSize, Addr, Accounts) ->
UploadFee = (?STATIC_2_6_8_FEE_WINSTON * 10 div ?GiB) * (DataSize + ?TX_SIZE_BASE),
case Addr == <<>> orelse maps:is_key(Addr, Accounts) of
true ->
UploadFee;
false ->
NewAccountFee = (?STATIC_2_6_8_FEE_WINSTON * 10 div ?GiB) *
?NEW_ACCOUNT_FEE_DATA_SIZE_EQUIVALENT,
UploadFee + NewAccountFee
end.

get_tx_fee2(Args) ->
{DataSize, PricePerGiBMinute, KryderPlusRateMultiplier, Addr, Accounts, Height} = Args,
Args2 = {DataSize + ?TX_SIZE_BASE, PricePerGiBMinute, KryderPlusRateMultiplier, Height},
Expand Down

0 comments on commit 5ac0b08

Please sign in to comment.