-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
177 changed files
with
2,805 additions
and
7,986 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ linters: | |
- gocritic | ||
- gofmt | ||
# - revive | ||
- gosec | ||
- gosimple | ||
- lll | ||
- unused | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/nfts/contracts/party-ticket/TaikoPartyTicketV2.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Compatible with OpenZeppelin Contracts ^5.0.0 | ||
pragma solidity ^0.8.24; | ||
|
||
import { TaikoPartyTicket } from "./TaikoPartyTicket.sol"; | ||
|
||
/// @title TaikoPartyTicketV2 | ||
/// @dev Upgrade to support Golden Ticket (winner of winners, singular) ticket | ||
/// @custom:security-contact [email protected] | ||
contract TaikoPartyTicketV2 is TaikoPartyTicket { | ||
/// @notice Get the version of the contract | ||
/// @return The version of the contract | ||
function version() public pure returns (string memory) { | ||
return "v2"; | ||
} | ||
|
||
/// @notice Get individual token's URI | ||
/// @param tokenId The token ID | ||
/// @return The token URI | ||
/// @dev re-implemented to support golden winner | ||
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { | ||
if (winnerIds.length == 0) { | ||
return string(abi.encodePacked(baseURI, "/raffle.json")); | ||
} else if (winners[tokenId] && winnerIds[0] == tokenId) { | ||
return string(abi.encodePacked(baseURI, "/golden-winner.json")); | ||
} else if (winners[tokenId]) { | ||
return string(abi.encodePacked(baseURI, "/winner.json")); | ||
} else { | ||
return string(abi.encodePacked(baseURI, "/loser.json")); | ||
} | ||
} | ||
|
||
/// @notice Checks if a tokenId is the golden winner | ||
/// @param tokenId The token ID | ||
/// @return True if the token is the golden winner | ||
function isGoldenWinner(uint256 tokenId) public view returns (bool) { | ||
return winners[tokenId] && winnerIds[0] == tokenId; | ||
} | ||
|
||
/// @notice Checks if an account has a golden winner token | ||
/// @param account The account address | ||
/// @return True if the account has a golden winner | ||
function isGoldenWinner(address account) public view returns (bool) { | ||
for (uint256 i = 0; i < balanceOf(account); i++) { | ||
if (isGoldenWinner(tokenOfOwnerByIndex(account, i))) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "[GW] KBW Party Raffle Ticket", | ||
"description": "A unique raffle ticket for the KBW Party. This ticket won a special prize at the raffle.", | ||
"image": "https://taikonfts.4everland.link/ipfs/bafybeif2piyppimpd4rn6wkq4mxtwdgajil7vt6shkb2gt72a2zyqufg2a/golden-winner.png" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "[L] KBW Party Raffle Ticket", | ||
"description": "A raffle ticket for the KBW Party. This ticket won nothing at the raffle.", | ||
"image": "https://taikonfts.4everland.link/ipfs/bafybeialwrhlnfb46o3mdd2gcrrc3ksf5exuji5lmwwcljynae4kdq4pae/loser.png" | ||
"image": "https://taikonfts.4everland.link/ipfs/bafybeif2piyppimpd4rn6wkq4mxtwdgajil7vt6shkb2gt72a2zyqufg2a/loser.png" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "KBW Party Raffle Ticket", | ||
"description": "A raffle ticket for the KBW Party. This ticket gives you a chance to win a special prize.", | ||
"image": "https://taikonfts.4everland.link/ipfs/bafybeialwrhlnfb46o3mdd2gcrrc3ksf5exuji5lmwwcljynae4kdq4pae/raffle.png" | ||
"image": "https://taikonfts.4everland.link/ipfs/bafybeif2piyppimpd4rn6wkq4mxtwdgajil7vt6shkb2gt72a2zyqufg2a/raffle.png" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "[W] KBW Party Raffle Ticket", | ||
"description": "A raffle ticket for the KBW Party. This ticket won a special prize at the raffle.", | ||
"image": "https://taikonfts.4everland.link/ipfs/bafybeialwrhlnfb46o3mdd2gcrrc3ksf5exuji5lmwwcljynae4kdq4pae/winner.gif", | ||
"animation_url": "https://taikonfts.4everland.link/ipfs/bafybeialwrhlnfb46o3mdd2gcrrc3ksf5exuji5lmwwcljynae4kdq4pae/winner.gif" | ||
"image": "https://taikonfts.4everland.link/ipfs/bafybeif2piyppimpd4rn6wkq4mxtwdgajil7vt6shkb2gt72a2zyqufg2a/winner.gif", | ||
"animation_url": "https://taikonfts.4everland.link/ipfs/bafybeif2piyppimpd4rn6wkq4mxtwdgajil7vt6shkb2gt72a2zyqufg2a/winner.gif" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"TaikoPartyTicket": "0x1fE073fb9C749Ba99aab01aEc4E9d08875ea55a9" | ||
"TaikoPartyTicket": "0x1d504615c42130F4fdbEb87775585B250BA78422" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"TaikoPartyTicket": "0x00E6dc8B0a58d505de61309df3568Ba3f9734a6C" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import { UtilsScript } from "./Utils.s.sol"; | ||
import { Script, console } from "forge-std/src/Script.sol"; | ||
import { Merkle } from "murky/Merkle.sol"; | ||
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
import { TaikoPartyTicket } from "../../../contracts/party-ticket/TaikoPartyTicket.sol"; | ||
import { IMinimalBlacklist } from "@taiko/blacklist/IMinimalBlacklist.sol"; | ||
import { TaikoPartyTicketV2 } from "../../../contracts/party-ticket/TaikoPartyTicketV2.sol"; | ||
|
||
contract DeployScript is Script { | ||
UtilsScript public utils; | ||
string public jsonLocation; | ||
uint256 public deployerPrivateKey; | ||
address public deployerAddress; | ||
|
||
// hekla | ||
//address tokenV1 = 0x1d504615c42130F4fdbEb87775585B250BA78422; | ||
// mainnet | ||
address tokenV1 = 0x00E6dc8B0a58d505de61309df3568Ba3f9734a6C; | ||
|
||
function setUp() public { | ||
utils = new UtilsScript(); | ||
utils.setUp(); | ||
|
||
jsonLocation = utils.getContractJsonLocation(); | ||
deployerPrivateKey = utils.getPrivateKey(); | ||
deployerAddress = utils.getAddress(); | ||
} | ||
|
||
function run() public { | ||
string memory jsonRoot = "root"; | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
TaikoPartyTicket token = TaikoPartyTicket(tokenV1); | ||
|
||
console.log("Deployed TaikoPartyTicket to:", address(token)); | ||
|
||
token.upgradeToAndCall( | ||
address(new TaikoPartyTicketV2()), abi.encodeCall(TaikoPartyTicketV2.version, ()) | ||
); | ||
|
||
TaikoPartyTicketV2 tokenV2 = TaikoPartyTicketV2(address(token)); | ||
console.log("Upgraded token to:", address(tokenV2)); | ||
console.log("Version:", tokenV2.version()); | ||
|
||
string memory finalJson = vm.serializeAddress(jsonRoot, "TaikoPartyTicket", address(token)); | ||
vm.writeJson(finalJson, jsonLocation); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
Oops, something went wrong.