Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/dev_mint_index.erl
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,14 @@ parse_signal(Base, Assignment, Opts) ->
),
{ok, Quantity} ?=
case hb_maps:find(<<"x-action">>, Msg, Opts) of
{ok, <<"deposit">>} -> {ok, RawQuantity};
{ok, <<"withdraw">>} -> {ok, -RawQuantity};
{ok, <<"deposit">>} when is_integer(RawQuantity), RawQuantity >= 0 ->
{ok, RawQuantity};
{ok, <<"deposit">>} ->
{error, <<"Deposit quantity must be a non-negative integer.">>};
{ok, <<"withdraw">>} when is_integer(RawQuantity), RawQuantity =< 0 ->
{ok, RawQuantity};
{ok, <<"withdraw">>} ->
{error, <<"Withdraw quantity must be a non-positive integer.">>};
{ok, _Unsupported} ->
{error, <<"Notification `action' unsupported.">>};
error ->
Expand Down Expand Up @@ -234,7 +240,7 @@ update_model(Address, Quantity, Base, Opts) ->
must_redelegate(Base, _Quantity, _Address, Opts) ->
UpdateEvery = hb_ao:get(<<"update-every">>, Base, 0, Opts),
ChangesSinceUpdate = hb_ao:get(<<"changes-since-update">>, Base, 0, Opts),
UpdateEvery >= ChangesSinceUpdate.
ChangesSinceUpdate >= UpdateEvery.

%% @doc Send messages reflecting updated delegation preferences to the parent
%% mint.
Expand Down