-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Opus Seasons #293
Add Opus Seasons #293
Conversation
- switch environment from dark shuffle tournament to season - improve styles
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes update environment flags to mark the current season as active while deactivating a specific tournament. UI components have been refreshed to display new season details, including updated texts, spacing, and prize calculations. Additionally, the code managing prize rendering is simplified by removing extra state variables. Finally, the tournament identifier has been updated in both configuration and transaction-related utility functions, with a refactoring that enhances code clarity. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User Action
participant S as startSeason Function
participant N as Network Config
participant T as Transaction Service
U->>S: Initiate start season
S->>N: Retrieve tournamentId for current network
N-->>S: Return tournamentId ("0x4")
S->>T: Call enterTournamentTx(tournamentId)
T-->>S: Transaction result
S->>U: Return updated season status
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
ui/src/app/components/start/SeasonDetails.tsx (1)
4-7
: Remove unused proplordsValue
.The
lordsValue
prop is passed to the component but is no longer used in the prize calculations.Apply this diff to remove the unused prop:
interface SeasonDetailsProps { prizes: any; - lordsValue: any; }
🧹 Nitpick comments (7)
ui/src/app/components/start/Prizes.tsx (4)
11-11
: Remove commented out code.Instead of keeping commented out code in the codebase, it should be removed since it can be retrieved from version control if needed. This improves code readability and maintainability.
- // const [lordsDollar, setLordsDollar] = useState<bigint>(0n); - - // const handleLordsDollarValue = async () => { - // const value = await lordsDollarValue(); - // setLordsDollar(value); - // }; - - // useEffect(() => { - // handleLordsDollarValue(); - // }, []);Also applies to: 13-16, 18-20
42-42
: Fix typo in className.The class name "item-scrol" appears to be missing an 'l' at the end.
- className="flex flex-row gap-5 overflow-scroll item-scrol h-10" + className="flex flex-row gap-5 overflow-scroll item-scroll h-10"
83-83
: Remove commented out Lords icon component.Remove the commented out code to maintain clean and readable codebase.
- {/* <Lords className="self-center w-4 h-4 sm:w-5 sm:h-5 fill-current" /> */}
84-86
: Improve readability of token value calculation.While the direct division simplifies the logic, the magic number
10 ** 18
should be extracted as a named constant to improve code readability and maintainability.+const TOKEN_DECIMALS = 18; +const TOKEN_DIVISOR = 10 ** TOKEN_DECIMALS; + const Prizes = ({ prizes, lordsDollarValue }: Prizes) => { // ... - ${tokenValue / 10 ** 18} + ${tokenValue / TOKEN_DIVISOR}ui/src/app/components/start/CreateAdventurer.tsx (3)
163-163
: Move end date to configuration.The season end date is hardcoded. Consider moving it to a configuration file or environment variable for easier updates.
156-161
: Enhance external link security.The external link to Opus website should include security-related attributes.
Apply this diff to enhance link security:
<a className="underline uppercase" href="https://www.opus.money/" + target="_blank" + rel="noopener noreferrer" + aria-label="Visit Opus website" > Visit Opus </a>
174-182
: Remove commented-out code.The "No Season Active" section is commented out. Since it's no longer needed, it should be removed to maintain code cleanliness.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
ui/.env
(1 hunks)ui/src/app/components/start/CreateAdventurer.tsx
(1 hunks)ui/src/app/components/start/Prizes.tsx
(3 hunks)ui/src/app/components/start/SeasonDetails.tsx
(4 hunks)ui/src/app/lib/networkConfig.ts
(1 hunks)ui/src/app/lib/utils/syscalls.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build and Test Contracts (game)
🔇 Additional comments (5)
ui/src/app/lib/networkConfig.ts (1)
70-70
: LGTM! Tournament ID updated for the new season.The change updates the tournament identifier from
"0x1"
to"0x4"
in the mainnet configuration, which aligns with adding a new Opus season.ui/src/app/lib/utils/syscalls.ts (1)
1661-1667
: LGTM! Improved code readability.The changes enhance code readability by extracting the tournament ID into a variable before using it in the
enterTournamentTx
call.ui/src/app/components/start/Prizes.tsx (1)
53-82
: Well-structured prize rendering with improved visual hierarchy!The changes nicely implement:
- Visual separation between prizes using dividers
- Position-based trophy colors
- Clear spacing and alignment
ui/src/app/components/start/SeasonDetails.tsx (1)
37-38
: Verify prize calculation changes.The prize calculations have been simplified to only divide by 10^18. Please ensure this matches the token decimals and doesn't affect the displayed values.
Run the following script to verify the token decimals:
Also applies to: 55-56, 73-74
❌ Verification inconclusive
🏁 Script executed:
#!/bin/bash # Description: Check token decimals in the contract ast-grep --pattern $'contract ERC20 { $$$ decimals() { $$$ } $$$ }'Length of output: 80
I'll run a more generic search to gather evidence of how the token decimals are defined in the repository. This updated script searches for files containing both the "ERC20" contract definition and the "decimals" function. We can then verify if the token uses 18 decimals as assumed.
Once we have the output, we can confirm whether the token decimals value is explicitly set (or assumed standard 18) in the contract. If no explicit decimals are found, please perform a manual check to ensure the value is as expected.
🏁 Script executed:
#!/bin/bash # Step 1: Search for the ERC20 contract definitions echo "Searching for ERC20 contract definitions..." rg --ignore-case "contract ERC20" -n . # Step 2: Search for the decimals function definition echo "Searching for decimals function definitions..." rg --ignore-case "function decimals\(" -n .Length of output: 286
Manual Verification Required: Token Decimals Confirmation
The search did not yield any explicit definitions of an ERC20
decimals
function, so we cannot confirm automatically whether the token uses 18 decimals. Please manually verify in your token contract or related deployment documentation that the decimals are indeed 18 to ensure the simplified prize calculation is correct.ui/.env (1)
3-6
: Verify tournament configuration consistency.The tournament is marked as inactive, but tournament ID and start time are still configured. Please verify if these values are still needed.
Run the following script to check tournament configuration usage:
✅ Verification successful
🏁 Script executed:
#!/bin/bash # Description: Check usage of tournament configuration rg "NEXT_PUBLIC_DS_TOURNAMENT_ID|NEXT_PUBLIC_DS_TOURNAMENT_START_TIME" -A 2Length of output: 648
I'll now search for references to NEXT_PUBLIC_DS_TOURNAMENT_ACTIVE to see if its value is used conditionally with the other tournament configuration values.
🏁 Script executed:
#!/bin/bash rg "NEXT_PUBLIC_DS_TOURNAMENT_ACTIVE" -A 2 -B 2Length of output: 771
Tournament configuration values are in active use despite the tournament being marked inactive.
- The tournament ID is referenced in
ui/src/app/components/leaderboard/SeasonTable.tsx
.- The tournament start time is referenced in
ui/src/app/components/start/DSTournamentOverview.tsx
.- The active flag, checked in multiple locations (e.g.,
ui/src/app/page.tsx
andSeasonTable.tsx
), determines whether tournament features should be enabled.This indicates that the values are retained intentionally—likely to enable quick toggling of tournament mode when needed. If the decision is to permanently disable tournament functionality, these values and their associated logic might be removed. Otherwise, their presence is consistent with the current design.
Summary by CodeRabbit