Skip to content
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

contracts & client config: scale building cost #1722

Merged
merged 3 commits into from
Oct 1, 2024

Conversation

credence0x
Copy link
Collaborator

contracts and client config for #1720

  • increase fixed cost of building by a certain percentage based on the number of the building type already on the realm

Copy link

vercel bot commented Sep 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eternum ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 27, 2024 8:49pm

Copy link

Failed to generate code suggestions for PR

Copy link
Contributor

@mentatbot mentatbot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation of scaled building costs looks good and covers both contract and client-side changes. The new BuildingGeneralConfig model and its usage are well-implemented. The changes to the create function in BuildingCustomImpl to return both the Building and BuildingQuantityv2 are appropriate. The client-side SDK updates in EternumProvider and config/index.ts are consistent with the contract changes. The removal of the BonusPercentageImpl in favor of using PercentageImpl and PercentageValueImpl from the math utils is a good refactoring. The changes seem to be backwards compatible and shouldn't break existing functionality. Overall, this is a solid implementation of the scaled building costs feature.

Thanks for using MentatBot. Give comments a 👍 or 👎 to help me improve!

contracts/src/models/buildings.cairo Show resolved Hide resolved
@@ -102,7 +102,7 @@ export const ONE_MONTH = 2628000;

// Buildings
export const BASE_POPULATION_CAPACITY = 5;

export const BUILDING_FIXED_COST_SCALE_PERCENT = 1_000; // 1_000/10_000 = 10%
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making this scaling factor more easily configurable, possibly as an environment variable or part of a configuration object.

contracts/src/models/buildings.cairo Outdated Show resolved Hide resolved
contracts/src/models/config.cairo Outdated Show resolved Hide resolved
Copy link
Collaborator

@edisontim edisontim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@edisontim edisontim merged commit f7c36c6 into main Oct 1, 2024
23 checks passed
@edisontim edisontim deleted the scale-building-fixed-cost branch October 1, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants