Skip to content

Commit

Permalink
feat: modify GetTotalEffectiveListedNFTAmount
Browse files Browse the repository at this point in the history
  • Loading branch information
Jecket1 committed Jul 19, 2024
1 parent 808e219 commit 1c8be44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion contract/Forest/ForestContract_Sellers.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Linq;
using AElf;
using AElf.Contracts.MultiToken;
Expand Down Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion test/Forest.Tests/ForestContractTests_Views.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 1c8be44

Please sign in to comment.