Skip to content

Commit

Permalink
fix stacking and king hands distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
Wagalidoom committed Jul 17, 2023
1 parent 57da7b2 commit 797d77b
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 93 deletions.
22 changes: 6 additions & 16 deletions contracts/NumberRunnerClub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ contract NumberRunnerClub is ERC721URIStorage, VRFV2WrapperConsumerBase, Ownable
uint256 public auctionEndTime;
// L'epoch actuel
uint256 public epoch = 0;
uint256[] kingHands;
uint256[10] kingHands;
bool isKingsHandSet = false;
uint256 public recentRequestId;
uint256 prizePool;
Expand Down Expand Up @@ -196,7 +196,7 @@ contract NumberRunnerClub is ERC721URIStorage, VRFV2WrapperConsumerBase, Ownable
// No restriction for minting Pawn
if (_pieceType != 5) {
bool hasRequiredClubStacked = false;
for (uint i = 7; i < pieceDetails[_pieceType].clubRequirement; i++) {
for (uint i = 7; i <= pieceDetails[_pieceType].clubRequirement; i++) {
bytes32 node = nodeOfTokenId[_stackedPiece];
bytes32 name = nameOfTokenId[_stackedPiece];
require(ens.owner(node) == msg.sender, "Not owner of ENS node");
Expand Down Expand Up @@ -264,15 +264,6 @@ contract NumberRunnerClub is ERC721URIStorage, VRFV2WrapperConsumerBase, Ownable
if (!isColorValid(tokenId)) {
burnedCounterCount[msg.sender]++;
}
if (getPieceType(tokenId) == 5) {
for (uint256 i = 0; i < kingHands.length; i++) {
if (tokenId == kingHands[i]) {
kingHands[i] = kingHands[kingHands.length - 1];
kingHands.pop();
emit KingHandBurned(tokenId);
}
}
}
currentSupply--;
nftShares[tokenId] = 0;
emit nftSharesUpdated(tokenId, 0);
Expand Down Expand Up @@ -482,7 +473,7 @@ contract NumberRunnerClub is ERC721URIStorage, VRFV2WrapperConsumerBase, Ownable
}

function revealKingHand(uint256 tokenId) public payable returns (bool) {
require(msg.value > 200000000000000000); // reveal price fixed at 0.2 eth
require(msg.value > 10000000000000); // reveal price fixed at 0.2 eth
require(ownerOf(tokenId) == msg.sender, "Not owner of NFT");
require(getPieceType(tokenId) == 5, "Token must be a Pawn");
// require(isStacked[tokenId] == false, "Token must be unstack");
Expand Down Expand Up @@ -549,17 +540,16 @@ contract NumberRunnerClub is ERC721URIStorage, VRFV2WrapperConsumerBase, Ownable
require(ownerOf(tokenId) == msg.sender, "Not owner of NFT");
uint256 i = 0;
bool isKingHand = false;
for (i; i < kingHands.length; i++) {
for (i; i < 10; i++) {
if (tokenId == kingHands[i]) {
isKingHand = true;
break;
}
}
require(isKingHand, "Token must be a King's Hand");
uint256 pieceShare = kingHandsPrize / kingHands.length;
uint256 pieceShare = kingHandsPrize / 10;
burn(tokenId);
payable(msg.sender).transfer(pieceShare);
kingHands[i] = kingHands[kingHands.length - 1];
kingHands.pop();
}

function vote(uint256 proposalId, uint256 tokenId, bool voteFor) public {
Expand Down
Loading

0 comments on commit 797d77b

Please sign in to comment.