-
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
adds view funcs and parameterized launch tourny configs #237
adds view funcs and parameterized launch tourny configs #237
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes introduce modifications to constants, interfaces, and functions across multiple files in the game codebase. Key updates include a reduction in the obituary expiry duration, the addition of new reward constants, and enhancements to the game interface with new methods for managing promotions and tournaments. The deployment script has also been updated to reflect these changes, particularly in how tournament parameters are configured. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GameContract
participant TournamentManager
User->>GameContract: Start Game
GameContract->>TournamentManager: Initialize Tournament Parameters
TournamentManager->>GameContract: Set Duration and Delay
GameContract->>User: Game Started with Promotions
Assessment against linked issues
Tip We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord. 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- contracts/game/src/game/constants.cairo (1 hunks)
- contracts/game/src/game/interfaces.cairo (1 hunks)
- contracts/game/src/lib.cairo (15 hunks)
- contracts/game/src/tests/test_game.cairo (60 hunks)
- scripts/deploy.sh (2 hunks)
Additional comments not posted (31)
scripts/deploy.sh (4)
24-24
: LGTM!The code change is approved. It replaces the
launch_promotion_end_timestamp
variable withlaunch_tournament_duration_seconds
to configure the tournament duration.
27-27
: LGTM!The code change is approved. It introduces a new variable
launch_tournament_start_delay_seconds
to configure the delay before the tournament starts.
28-28
: LGTM!The code change is approved. It introduces a new variable
free_vrf_promotion_duration_seconds
to configure the duration of a promotional event related to VRF (Verifiable Random Function).
49-49
: LGTM!The code change is approved. It updates the deployment command for the game contract to include the new tournament parameters, replacing the previous timestamp variable with the newly defined duration and delay variables. This change enhances the configurability of the tournament mechanics.
contracts/game/src/game/constants.cairo (3)
17-17
: Verify the impact of reducing the obituary expiry duration.The
OBITUARY_EXPIRY_DAYS
constant has been reduced from 10 days to 1 day. This is a significant reduction in the duration for which obituaries are considered valid.Please verify the following:
- Ensure that this change does not introduce any unintended side effects or break existing functionality related to obituaries.
- Confirm if the reduced expiry duration aligns with the desired game mechanics and user experience.
- Update any relevant documentation or comments to reflect this change.
22-22
: Provide more context about theDAO_CONTRACT_REWARD_ADVENTURER
constant.A new constant
DAO_CONTRACT_REWARD_ADVENTURER
with a value of 2 has been introduced.Please provide more information about the purpose and usage of this constant:
- How is this constant used within the game's reward mechanisms?
- In what scenarios or conditions will adventurers receive this reward in the DAO context?
- Are there any related functions or code sections where this constant is utilized?
Adding comments or documentation to explain the role of this constant would be helpful for maintainability and understanding the game's reward system.
23-23
: Provide more context about thePG_CONTRACT_REWARD_ADVENTURER
constant.A new constant
PG_CONTRACT_REWARD_ADVENTURER
with a value of 3 has been introduced.Please provide more information about the purpose and usage of this constant:
- How is this constant used within the game's reward mechanisms?
- In what scenarios or conditions will adventurers receive this reward in the PG context?
- Are there any related functions or code sections where this constant is utilized?
Adding comments or documentation to explain the role of this constant would be helpful for maintainability and understanding the game's reward system.
contracts/game/src/game/interfaces.cairo (4)
142-142
: LGTM!The code changes are approved.
143-143
: LGTM!The code changes are approved.
144-144
: LGTM!The code changes are approved.
145-145
: LGTM!The code changes are approved.
contracts/game/src/tests/test_game.cairo (13)
32-32
: LGTM!The code changes are approved.
Line range hint
436-445
: LGTM!The code changes are approved.
451-453
: LGTM!The code changes are approved.
465-465
: LGTM!The code changes are approved.
470-472
: LGTM!The code changes are approved.
475-475
: LGTM!The code changes are approved.
478-479
: LGTM!The code changes are approved.
484-484
: LGTM!The code changes are approved.
530-532
: LGTM!The code changes are approved.
539-544
: LGTM!The code changes are approved.
550-554
: LGTM!The code changes are approved.
564-567
: LGTM!The code changes are approved.
Line range hint
581-601
: LGTM!The code changes are approved.
contracts/game/src/lib.cairo (7)
97-98
: LGTM!The addition of the new constants looks good.
1270-1281
: LGTM!The addition of the new view functions looks good. They provide a clear way to query the state of the free VRF promotion and launch tournament.
1288-1316
: LGTM!The new
_mint_genesis_adventurers
function looks good. It properly mints the genesis adventurers to the DAO and PG addresses.
3545-3557
: LGTM!The changes to the
_is_expired
function to not expire genesis adventurers look good.
3624-3629
: LGTM!The new
_launch_tournament_end_time
function looks good. It properly calculates the launch tournament end time based on the stored state variables.
3633-3634
: LGTM!The changes to the
_is_launch_tournament_active
function to use the new_launch_tournament_end_time
function look good.
157-157
: Verify the usage of the new state variables and functions.The changes to the constructor look good. The new state variables are properly initialized and the new functions are called appropriately.
Please verify that the new state variables and functions are used correctly in the rest of the codebase. You can use the following script to search for their usage:
Also applies to: 159-159, 167-167, 170-170, 308-309, 341-344, 350-352
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- contracts/game/src/tests/test_game.cairo (60 hunks)
Files skipped from review as they are similar to previous changes (1)
- contracts/game/src/tests/test_game.cairo
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- contracts/game/src/lib.cairo (15 hunks)
- contracts/game/src/tests/test_game.cairo (60 hunks)
Additional comments not posted (23)
contracts/game/src/tests/test_game.cairo (10)
32-32
: LGTM!The new constant
OBITUARY_EXPIRY_DAYS
is properly declared.
80-82
: LGTM!The new constants are properly declared:
LAUNCH_TOURNAMENT_GAMES_PER_COLLCTION
LAUNCH_TOURNAMENT_START_DELAY_SECONDS
FREE_VRF_PROMOTION_DURATION_SECONDS
251-259
: LGTM!The
deploy_lootsurvivor
function signature is properly updated:
- Parameter
launch_tournament_end_time
is changed tolaunch_promotion_duration_seconds
, which better reflects its purpose.
285-289
: LGTM!The following new parameters are properly appended to the
calldata
in thedeploy_lootsurvivor
function:
launch_promotion_duration_seconds
VRF_PREMIUMS_ADDRESS()
LAUNCH_TOURNAMENT_GAMES_PER_COLLCTION
LAUNCH_TOURNAMENT_START_DELAY_SECONDS
FREE_VRF_PROMOTION_DURATION_SECONDS
300-307
: LGTM!The
deploy_game
function signature is properly updated:
- Parameter
terminal_timestamp
is changed tolaunch_promotion_duration_seconds
, which better reflects its purpose.
Line range hint
436-465
: LGTM!The
new_adventurer
function is properly updated:
- It now returns a tuple
(IGameDispatcher, felt252)
, which allows for more flexibility in testing.- The
game.get_adventurer
,game.get_adventurer_name
, andgame.get_adventurer_meta
function calls are updated to use theadventurer_id
returned bygame.new_game
, which is correct.
530-532
: LGTM!The
test_start
function is properly updated to use theadventurer_id
returned by thenew_adventurer
function, which is correct.
1734-1743
: LGTM!The new
transfer_ownership
function is properly implemented:
- It transfers the ownership of an adventurer using the provided
from
,to
, andadventurer_id
parameters.- Using the
IERC721Dispatcher
to calltransfer_from
directly is a valid workaround for the mentioned compiler issue.
2675-2678
: LGTM!The new variables and function call are properly used to set up the test environment:
launch_tournament_duration_seconds
andcontract_deploy_time
are introduced.- The
start_cheat_block_timestamp_global
function is called withcontract_deploy_time
.
Line range hint
2713-2751
: LGTM!The
test_settle_launch_tournament
andtest_settle_launch_tournament_before_end
functions are properly updated to use the_launch_tournament_duration_seconds
storage variable, which is correct and consistent with the contract changes.contracts/game/src/lib.cairo (13)
97-98
: LGTM!The addition of the new constants is approved.
157-159
: LGTM!The addition of the new storage variables is approved.
167-170
: LGTM!The addition of the new storage variables for launch tournament configuration is approved.
244-250
: LGTM!The updates to the constructor parameters to support launch tournament duration, start delay, and free VRF promotion duration are approved.
311-320
: LGTM!The initialization of the new storage variables
_genesis_timestamp
,_launch_tournament_duration_seconds
, and_launch_tournament_start_delay_seconds
in the constructor is implemented correctly.
344-347
: LGTM!The initialization of the
_free_vrf_promotion_duration_seconds
storage variable in the constructor is implemented correctly.
353-355
: LGTM!The addition of the call to
_mint_genesis_adventurers
in the constructor is approved. The implementation of this function should be reviewed separately.
1273-1284
: LGTM!The addition of the new view functions
free_vrf_promotion_active
,is_launch_tournament_active
,get_launch_tournament_winner
, andget_launch_tournament_end_time
is approved. The implementations of these functions should be reviewed separately.
1291-1326
: LGTM!The implementation of
_mint_genesis_adventurers
is correct. It mints three special genesis adventurers with specific weapons and names to the DAO and PG addresses, aligning with the objectives mentioned in the PR summary.
1327-1332
: LGTM!The implementation of
_free_vrf_promotion_active
is correct. It correctly checks if the current timestamp is within the free VRF promotion duration starting from the genesis timestamp.
3555-3567
: LGTM!The update to
_is_expired
to handle genesis adventurers is implemented correctly. It ensures that genesis adventurers never expire while maintaining the existing expiry logic for non-genesis adventurers.
3634-3639
: LGTM!The implementation of
_launch_tournament_end_time
is correct. It accurately calculates the end timestamp of the launch tournament based on the genesis timestamp, tournament duration, and start delay.
3713-3714
: LGTM!The renaming of
_get_tournament_winner
to_get_launch_tournament_winner
is approved. It aligns with the naming convention used for other launch tournament related functions.
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- contracts/game/src/tests/test_game.cairo (61 hunks)
Files skipped from review as they are similar to previous changes (1)
- contracts/game/src/tests/test_game.cairo
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- contracts/game/src/tests/test_game.cairo (63 hunks)
Files skipped from review as they are similar to previous changes (1)
- contracts/game/src/tests/test_game.cairo
free_vrf_promotion_active() -> bool
. Closes add view function for free_vrf_promotion_active -> bool #233is_launch_tournament_active() -> bool
get_launch_tournament_winner() -> ContractAddress
get_launch_tournament_end_time() -> u64
launch_tournament_end_time
tolaunch_tournament_duration
launch_tournament_delay_seconds
parameter to constructor to allow time delay between contract deployment and start of launch tournament (qualifying NFT claims). Closes Add a launch tournament delay parameter to constructor #228free_vrf_promotion_duration_seconds
parameter to constructorSummary by CodeRabbit
New Features
Bug Fixes
Chores