diff --git a/contract/Forest/ForestContract_Sellers.cs b/contract/Forest/ForestContract_Sellers.cs index b0cbf62..e9904e6 100644 --- a/contract/Forest/ForestContract_Sellers.cs +++ b/contract/Forest/ForestContract_Sellers.cs @@ -1,3 +1,4 @@ +using System; using System.Linq; using AElf; using AElf.Contracts.MultiToken; @@ -120,11 +121,13 @@ public override Empty ListWithFixedPrice(ListWithFixedPriceInput input) Quantity = input.Quantity, WhitelistId = whitelistId }); + var allowance = GetAllowance(Context.Sender, input.Symbol); var collectionSymbol = TransferCollectionSymbol(input.Symbol); var collectionAllowance = State.ListedNFTTotalAmountMap[collectionSymbol][Context.Sender]; if (collectionAllowance == null || collectionAllowance == "") { - State.ListedNFTTotalAmountMap[collectionSymbol][Context.Sender] = input.Quantity.ToString(); + State.ListedNFTTotalAmountMap[collectionSymbol][Context.Sender] = + Math.Max(allowance, input.Quantity).ToString(); } else { diff --git a/test/Forest.Tests/ForestContractTests_Views.cs b/test/Forest.Tests/ForestContractTests_Views.cs index 9e065af..a9d6213 100644 --- a/test/Forest.Tests/ForestContractTests_Views.cs +++ b/test/Forest.Tests/ForestContractTests_Views.cs @@ -1185,7 +1185,7 @@ await BuyerForestContractStub.MakeOffer.SendAsync(new MakeOfferInput() Address = User1Address })); getTotalEffectiveListedNftAmount.Allowance.ShouldBe(0); - getTotalEffectiveListedNftAmount.TotalAmount.ShouldBe(sellQuantity); + getTotalEffectiveListedNftAmount.TotalAmount.ShouldBe(sellQuantity*2); } #endregion