Skip to content

Commit 8d733b0

Browse files
authored
Merge pull request #3361 from AElfProject/hotfix/method-fee-free-allowances
Fix wrong method fee free allowances for balance less than threshold
2 parents 3906a55 + d94588f commit 8d733b0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

contract/AElf.Contracts.MultiToken/TokenContract_Fees.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ private void SetOrRefreshMethodFeeFreeAllowances(Address address)
151151
var config = State.MethodFeeFreeAllowancesConfig.Value;
152152
if (config == null || State.Balances[address][Context.Variables.NativeSymbol] < config.Threshold)
153153
{
154-
// Won't refresh method fee free allowance if inputted address hasn't reach the threshold.
155154
return;
156155
}
157156

@@ -919,11 +918,14 @@ private MethodFeeFreeAllowances CalculateMethodFeeFreeAllowances(Address input)
919918

920919
var config = freeAllowancesConfig.Clone();
921920

921+
var balance = State.Balances[input][Context.Variables.NativeSymbol];
922+
if (balance < config.Threshold) return new MethodFeeFreeAllowances();
923+
922924
var lastRefreshTime = State.MethodFeeFreeAllowancesLastRefreshTimeMap[input];
923925

924926
if (freeAllowances == null)
925927
{
926-
if (State.Balances[input][Context.Variables.NativeSymbol] >= config.Threshold)
928+
if (balance >= config.Threshold)
927929
{
928930
return new MethodFeeFreeAllowances { Value = { config.FreeAllowances.Value } };
929931
}

0 commit comments

Comments
 (0)