Skip to content

Commit

Permalink
fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fyannch committed Jul 24, 2024
1 parent f819a1a commit 1d09f65
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions contract/Forest/ForestContractConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public partial class ForestContract
public const string CollectionSymbolSuffix = "0";
public const string SymbolSeparator = "-";
public const long DefaultApproveAllowance = 10000;
public const long MaxApproveAllowance = 9223372036854775000;

public const long MaxApproveAllowance = 9223372036854770000;


}
4 changes: 2 additions & 2 deletions contract/Forest/ForestContract_Sellers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ public override Empty ListWithFixedPrice(ListWithFixedPriceInput input)
var collectionAllowance = State.ListedNFTTotalAmountMap[collectionSymbol][Context.Sender];
if (collectionAllowance == null || collectionAllowance == "")
{
var listedNFTTotalAmount = (allowance == MaxApproveAllowance) ? input.Quantity : Math.Max(allowance, input.Quantity);
var listedNFTTotalAmount = (allowance >= MaxApproveAllowance) ? input.Quantity : Math.Max(allowance, input.Quantity);
State.ListedNFTTotalAmountMap[collectionSymbol][Context.Sender] = listedNFTTotalAmount.ToString();
}
else
{
var originQuantity = (long.Parse(collectionAllowance) == MaxApproveAllowance)
var originQuantity = (long.Parse(collectionAllowance) >= MaxApproveAllowance)
? DefaultApproveAllowance
: long.Parse(collectionAllowance);
State.ListedNFTTotalAmountMap[collectionSymbol][Context.Sender] =
Expand Down
4 changes: 2 additions & 2 deletions contract/Forest/ForestContract_Views.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ public override GetTotalEffectiveListedNFTAmountOutput GetTotalEffectiveListedNF
{
Symbol = input.Symbol,
Allowance = allowance,
TotalAmount = (allowance == MaxApproveAllowance) ? totalAmount : Math.Max(allowance,totalAmount)
TotalAmount = (allowance >= MaxApproveAllowance) ? totalAmount : Math.Max(allowance,totalAmount)
};
}

var getTotalEffectiveListedNftAmountOutput = new GetTotalEffectiveListedNFTAmountOutput()
{
Symbol = input.Symbol,
Allowance = allowance,
TotalAmount = (long.Parse(collectionAllowance) == MaxApproveAllowance) ? DefaultApproveAllowance : long.Parse(collectionAllowance)
TotalAmount = (long.Parse(collectionAllowance) >= MaxApproveAllowance) ? DefaultApproveAllowance : long.Parse(collectionAllowance)
};

return getTotalEffectiveListedNftAmountOutput;
Expand Down

0 comments on commit 1d09f65

Please sign in to comment.