Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
fix issue with validUntil
Browse files Browse the repository at this point in the history
  • Loading branch information
fudgebucket27 committed Feb 22, 2023
1 parent 8ea6646 commit 72e6270
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions LoopMintSharp/Services/Minter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ public async Task<RedPacketNftMintResponse> MintRedPacketNft(
{
var dateTimeNow = DateTimeOffset.UtcNow;
long validSince = dateTimeNow.ToUnixTimeSeconds();
var validUntil = dateTimeNow.AddDays(validUntilDays).ToUnixTimeSeconds(); ;
var validUntil30Days = dateTimeNow.AddDays(30).ToUnixTimeSeconds();
var validUntil = dateTimeNow.AddDays(validUntilDays).ToUnixTimeSeconds();
var offchainFee = await loopringMintService.GetOffChainFeeWithAmount(loopringApiKey, accountId, 0, 11, nftBalance.data[0].tokenAddress, verboseLogging);
var storageId = await loopringMintService.GetNextStorageId(loopringApiKey, accountId, nftBalance.data[0].tokenId, verboseLogging);

Expand All @@ -407,7 +408,7 @@ public async Task<RedPacketNftMintResponse> MintRedPacketNft(
Utils.ParseHexUnsigned("0x9cde4366824d9410fb2e2f885601933a926f40d7"),
(BigInteger) 0,
(BigInteger) 0,
(BigInteger) validUntil,
(BigInteger) validUntil30Days,
(BigInteger) storageId.offchainId
};
Poseidon poseidon = new Poseidon(13, 6, 53, "poseidon", 5, _securityTarget: 128);
Expand Down Expand Up @@ -457,7 +458,7 @@ public async Task<RedPacketNftMintResponse> MintRedPacketNft(
new MemberValue {TypeName = "uint96", Value = BigInteger.Parse(amountOfNftsPerPacket) * BigInteger.Parse(amountOfPackets)},
new MemberValue {TypeName = "uint16", Value = maxFeeTokenId},
new MemberValue {TypeName = "uint96", Value = BigInteger.Parse(offchainFee.fees[maxFeeTokenId].fee)},
new MemberValue {TypeName = "uint32", Value = validUntil},
new MemberValue {TypeName = "uint32", Value = validUntil30Days},
new MemberValue {TypeName = "uint32", Value = storageId.offchainId},
};

Expand All @@ -478,7 +479,7 @@ public async Task<RedPacketNftMintResponse> MintRedPacketNft(
amount = (BigInteger.Parse(amountOfNftsPerPacket) * BigInteger.Parse(amountOfPackets)).ToString(),
feeTokenID = maxFeeTokenId,
maxFee = offchainFee.fees[maxFeeTokenId].fee,
validUntil = (int)validUntil,
validUntil = (int)validUntil30Days,
storageID = storageId.offchainId
},
primaryType = primaryTypeName,
Expand Down Expand Up @@ -523,7 +524,7 @@ public async Task<RedPacketNftMintResponse> MintRedPacketNft(
luckyToken.amount = (int.Parse(amountOfNftsPerPacket) * int.Parse(amountOfPackets)).ToString();
luckyToken.feeToken = maxFeeTokenId;
luckyToken.maxFeeAmount = offchainFee.fees[maxFeeTokenId].fee;
luckyToken.validUntil = validUntil;
luckyToken.validUntil = validUntil30Days;
luckyToken.payeeId = 0;
luckyToken.memo = $"LuckTokenSendBy{accountId}";
luckyToken.eddsaSig = eddsaSignature;
Expand Down
2 changes: 1 addition & 1 deletion LoopMintSharp/nftData.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0x28bf23fcae889a0d3fc9f5f67cf6aa62c5565de56c1572c6830cd037e5dc9fe2,10,10,30,false
0x28bf23fcae889a0d3fc9f5f67cf6aa62c5565de56c1572c6830cd037e5dc9fe2,1,1,15,false

0 comments on commit 72e6270

Please sign in to comment.