diff --git a/client/.env.local.sample b/client/.env.local.sample index 267d6f054..6ba81c83d 100644 --- a/client/.env.local.sample +++ b/client/.env.local.sample @@ -25,4 +25,4 @@ VITE_REALMS_ADDRESS=0x755683a990769aad84fa4127bfc8dfa685d4f4fd751bd43e47ca46ff72 VITE_LORDS_ADDRESS=0x5a4cee7e1bfee8a41f884cbdcb17f051ca7cd46bbd5598f91c01887b2f83ee6 VITE_VRF_PROVIDER_ADDRESS="0x0" -VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 +VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 diff --git a/client/.env.preview b/client/.env.preview index b9b3d6208..07d04dbc3 100644 --- a/client/.env.preview +++ b/client/.env.preview @@ -26,4 +26,4 @@ VITE_PUBLIC_IMAGE_PROXY_URL=https://abc.com VITE_PUBLIC_IPFS_GATEWAY=https://abc.com VITE_VRF_PROVIDER_ADDRESS="0x051fea4450da9d6aee758bdeba88b2f665bcbf549d2c61421aa724e9ac0ced8f" -VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 +VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 diff --git a/client/src/ui/components/cityview/realm/SettleRealmComponent.tsx b/client/src/ui/components/cityview/realm/SettleRealmComponent.tsx index 9daf46b17..c1aeb870c 100644 --- a/client/src/ui/components/cityview/realm/SettleRealmComponent.tsx +++ b/client/src/ui/components/cityview/realm/SettleRealmComponent.tsx @@ -32,7 +32,7 @@ const SettleRealmComponent = ({ setSettledRealmId }: { setSettledRealmId: (id: n const res = await create_multiple_realms({ realm_ids: realmIds, owner: account.address, - frontend: env.VITE_CLIENT_FEE_RECIPIENT, + frontend: env.VITE_PUBLIC_CLIENT_FEE_RECIPIENT, signer: account, season_pass_address: env.VITE_SEASON_PASS_ADDRESS, }); diff --git a/client/src/ui/modules/onboarding/Steps.tsx b/client/src/ui/modules/onboarding/Steps.tsx index 4b25af426..155eb4e91 100644 --- a/client/src/ui/modules/onboarding/Steps.tsx +++ b/client/src/ui/modules/onboarding/Steps.tsx @@ -103,7 +103,7 @@ export const SettleRealm = ({ onPrevious }: { onPrevious: () => void }) => { const res = await create_multiple_realms({ realm_ids: realmIds, owner: account.address, - frontend: env.VITE_CLIENT_FEE_RECIPIENT, + frontend: env.VITE_PUBLIC_CLIENT_FEE_RECIPIENT, signer: account, season_pass_address: env.VITE_SEASON_PASS_ADDRESS, }); diff --git a/contracts/src/models/combat.cairo b/contracts/src/models/combat.cairo index 79bf36823..6c9cecef2 100644 --- a/contracts/src/models/combat.cairo +++ b/contracts/src/models/combat.cairo @@ -167,6 +167,14 @@ impl TroopsImpl of TroopsTrait { return resource_precision_u64; } + fn assert_minimum_for_battle(self: Troops) { + let total = self.knight_count + self.paladin_count + self.crossbowman_count; + assert!( + total >= (100 * RESOURCE_PRECISION).try_into().unwrap(), + "you need to have at least have 100 troops for battle" + ); + } + fn assert_normalized(self: Troops) { assert!( self.knight_count % Self::normalization_factor() == 0, diff --git a/contracts/src/systems/combat/contracts/battle_systems.cairo b/contracts/src/systems/combat/contracts/battle_systems.cairo index d72940a5a..9aa9af35e 100644 --- a/contracts/src/systems/combat/contracts/battle_systems.cairo +++ b/contracts/src/systems/combat/contracts/battle_systems.cairo @@ -364,6 +364,7 @@ mod battle_systems { let mut attacking_army: Army = world.read_model(attacking_army_id); attacking_army.assert_not_in_battle(); + attacking_army.troops.assert_minimum_for_battle(); let attacking_army_entity_owner: EntityOwner = world.read_model(attacking_army_id); attacking_army_entity_owner.assert_caller_owner(world); @@ -877,6 +878,7 @@ mod battle_pillage_systems { // ensure attacking army is not in a battle let mut attacking_army: Army = world.read_model(army_id); attacking_army.assert_not_in_battle(); + attacking_army.troops.assert_minimum_for_battle(); // ensure army is at structure position let army_position: Position = world.read_model(army_id); diff --git a/landing/.env.production b/landing/.env.production index 1d9dc395b..964787b0f 100644 --- a/landing/.env.production +++ b/landing/.env.production @@ -27,4 +27,4 @@ VITE_PUBLIC_IMAGE_PROXY_URL=https://abc.com VITE_PUBLIC_IPFS_GATEWAY=https://abc.com VITE_VRF_PROVIDER_ADDRESS="0x051fea4450da9d6aee758bdeba88b2f665bcbf549d2c61421aa724e9ac0ced8f" -VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 +VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 diff --git a/landing/.env.sample b/landing/.env.sample index 298193309..3937049f5 100644 --- a/landing/.env.sample +++ b/landing/.env.sample @@ -28,4 +28,4 @@ VITE_LORDS_ADDRESS=0x5f6c0fdb83120c1314d2152a98ade017117f1565333e13784b318ea32c5 VITE_VRF_PROVIDER_ADDRESS="0x051fea4450da9d6aee758bdeba88b2f665bcbf549d2c61421aa724e9ac0ced8f" -VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 +VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 diff --git a/landing/.env.sepolia b/landing/.env.sepolia index 8fc549bd4..97225fa46 100644 --- a/landing/.env.sepolia +++ b/landing/.env.sepolia @@ -28,4 +28,4 @@ VITE_PUBLIC_IMAGE_PROXY_URL=https://abc.com VITE_PUBLIC_IPFS_GATEWAY=https://abc.com VITE_VRF_PROVIDER_ADDRESS="0x051fea4450da9d6aee758bdeba88b2f665bcbf549d2c61421aa724e9ac0ced8f" -VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 \ No newline at end of file +VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5 \ No newline at end of file