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

updates #2394

Merged
merged 79 commits into from
Dec 11, 2024
Merged

updates #2394

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
3811e40
remove tests because of unknown file extension wasm
edisontim Dec 8, 2024
b484ed4
improve socials
aymericdelab Dec 10, 2024
7024782
Fix market lords input cost for wonders
bob0005 Dec 10, 2024
fcedbb3
add countdown backdrop (#2383)
edisontim Dec 10, 2024
50196a3
lint
bob0005 Dec 10, 2024
1ee218d
knip
bob0005 Dec 10, 2024
43654f7
dry
bob0005 Dec 10, 2024
c5f86fd
Merge branch 'next' into fix/wonders-lords-cost
bob0005 Dec 10, 2024
662d5b3
Merge branch 'main' into next
bob0005 Dec 10, 2024
3f6171c
Merge branch 'next' into fix/wonders-lords-cost
bob0005 Dec 10, 2024
e1092f3
Fix tool version
bob0005 Dec 10, 2024
e912561
update dojo version in ci
bob0005 Dec 10, 2024
7bc9368
make onboarding stricter (#2387)
edisontim Dec 10, 2024
90aac3e
add countdown backdrop (#2383) (#2385) (#2389)
edisontim Dec 10, 2024
a7a3778
Merge branch 'main' of github.com:BibliothecaDAO/eternum into next
edisontim Dec 10, 2024
895f328
fix: realm update at settle
r0man1337 Dec 10, 2024
f6b3226
fix: remove commnets
r0man1337 Dec 10, 2024
2c31fdd
update ToS
bob0005 Dec 10, 2024
94d671a
fix: code improvements
r0man1337 Dec 10, 2024
b010ea5
Checklist (#2392)
ponderingdemocritus Dec 10, 2024
ae73dfd
feat: wonder model
r0man1337 Dec 10, 2024
374af07
mani
ponderingdemocritus Dec 10, 2024
1cfe4ff
Merge pull request #2384 from BibliothecaDAO/fix/wonders-lords-cost
ponderingdemocritus Dec 10, 2024
cdd1c79
Merge pull request #2391 from BibliothecaDAO/enh/tos
ponderingdemocritus Dec 10, 2024
c51c1ae
fix: army movement fix
r0man1337 Dec 10, 2024
b713ae2
Merge pull request #2393 from BibliothecaDAO/feat/wonder
ponderingdemocritus Dec 10, 2024
4f6a020
Merge pull request #2390 from BibliothecaDAO/final/fixes
ponderingdemocritus Dec 10, 2024
4ec5d93
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
spaghettiOnToast Dec 10, 2024
5708473
- update storage utils function
spaghettiOnToast Dec 10, 2024
82340b9
smol design
spaghettiOnToast Dec 10, 2024
39ac47d
updates
ponderingdemocritus Dec 10, 2024
549f68f
revert
ponderingdemocritus Dec 10, 2024
314eb97
Merge pull request #2395 from BibliothecaDAO/loaf-update
ponderingdemocritus Dec 10, 2024
7468636
Merge branch 'main' of https://github.com/BibliothecaDAO/eternum into…
spaghettiOnToast Dec 10, 2024
76936a7
Revert "feat: wonder model"
bob0005 Dec 10, 2024
d513960
polices
ponderingdemocritus Dec 10, 2024
f33de42
Merge pull request #2396 from BibliothecaDAO/revert-wonder-model
ponderingdemocritus Dec 10, 2024
4200015
Merge pull request #2397 from BibliothecaDAO/loaf-update
ponderingdemocritus Dec 10, 2024
b78238b
Merge pull request #2398 from spaghettiOnToast/feat/docs-storage
ponderingdemocritus Dec 10, 2024
163cbc0
add wallet balance to bridge in
RedBeardEth Dec 11, 2024
3a4f397
Merge remote-tracking branch 'origin/next' into bridge
RedBeardEth Dec 11, 2024
a7bb6fe
refactor and fix arrivals
aymericdelab Dec 11, 2024
53335fc
Merge branch 'raschel-dev' of https://github.com/BibliothecaDAO/etern…
aymericdelab Dec 11, 2024
3bf3f19
minor config
ponderingdemocritus Dec 11, 2024
2d48a93
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
ponderingdemocritus Dec 11, 2024
2d0e447
prettier
ponderingdemocritus Dec 11, 2024
45276ff
Merge pull request #2400 from BibliothecaDAO/loaf-update
ponderingdemocritus Dec 11, 2024
fd975b9
Merge remote-tracking branch 'origin/next' into bridge
RedBeardEth Dec 11, 2024
9574933
Merge pull request #2399 from BibliothecaDAO/raschel-dev
ponderingdemocritus Dec 11, 2024
5f39b34
udpate prize pool calculation
RedBeardEth Dec 11, 2024
75dc84e
comment out
ponderingdemocritus Dec 11, 2024
7e62c0d
bridge UX
RedBeardEth Dec 11, 2024
288682f
optimisations
ponderingdemocritus Dec 11, 2024
c1f7bf0
prettier
RedBeardEth Dec 11, 2024
028cd06
Merge pull request #2401 from BibliothecaDAO/bridge
RedBeardEth Dec 11, 2024
2635cbb
fix countdown timer
edisontim Dec 11, 2024
b1ba803
hyperstrucutre points
ponderingdemocritus Dec 11, 2024
d76a818
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
ponderingdemocritus Dec 11, 2024
8209d62
Merge pull request #2402 from BibliothecaDAO/fix/countdown-timer
ponderingdemocritus Dec 11, 2024
9ecd078
fix hyperstructure shares
edisontim Dec 11, 2024
55c0250
Merge pull request #2404 from BibliothecaDAO/feat/hyperstructure-shares
ponderingdemocritus Dec 11, 2024
07cf7f2
heading
ponderingdemocritus Dec 11, 2024
eec2bc2
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
ponderingdemocritus Dec 11, 2024
c87623f
comment out interval
ponderingdemocritus Dec 11, 2024
277041c
frag
ponderingdemocritus Dec 11, 2024
47a42fd
feat: wonder model
r0man1337 Dec 10, 2024
51c699a
name
ponderingdemocritus Dec 11, 2024
99ccb5b
fix: nextBlockTimestamp refactor (#2405)
r0man1337 Dec 11, 2024
ffcd1e5
Merge pull request #2406 from BibliothecaDAO/feat/wonders2
ponderingdemocritus Dec 11, 2024
e6dfc3d
revert comment
ponderingdemocritus Dec 11, 2024
b35c0c7
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
ponderingdemocritus Dec 11, 2024
783d0a0
revert comment
aymericdelab Dec 11, 2024
f633a8c
Merge pull request #2407 from BibliothecaDAO/liquidity-rules
ponderingdemocritus Dec 11, 2024
482cb14
docs
ponderingdemocritus Dec 11, 2024
6f4918f
bridge
ponderingdemocritus Dec 11, 2024
e3b2744
clean
ponderingdemocritus Dec 11, 2024
e2ceee3
lint
ponderingdemocritus Dec 11, 2024
e837771
pwa assets
ponderingdemocritus Dec 11, 2024
2bdb72f
update prod vars
ponderingdemocritus Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
steps:
- name: Download Dojo release artifact
run: |
curl -L -o dojo-linux-x86_64.tar.gz https://github.com/dojoengine/dojo/releases/download/v1.0.3/dojo_v1.0.3_linux_amd64.tar.gz
curl -L -o dojo-linux-x86_64.tar.gz https://github.com/dojoengine/dojo/releases/download/v1.0.5/dojo_v1.0.5_linux_amd64.tar.gz
tar -xzf dojo-linux-x86_64.tar.gz
sudo mv sozo /usr/local/bin/
- name: Checkout repository
Expand Down
6 changes: 6 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

"sdk/packages/eternum/global.d.ts",
"config/bank/index.ts",
"config/speed.ts",

"**/**__test__**/**",
"**/**__tests__**/**",

Expand All @@ -24,6 +26,10 @@
"landing/**",
"client/pwa-assets.config.ts",

"docs/components/**",
"docs/utils/**",
"vocs.config.ts",

"client/src/ui/modules/chat/types.tsx",
"client/src/ui/modules/chat/constants.tsx",
"client/src/ui/modules/chat/ChatTab.tsx",
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scarb 2.8.4
dojo 1.0.3
dojo 1.0.5
6 changes: 3 additions & 3 deletions client/.env.preview
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ VITE_PUBLIC_MASTER_PRIVATE_KEY=0x075362a844768f31c8058ce31aec3dd7751686440b4f220
VITE_PUBLIC_WORLD_ADDRESS="0x00fd85ef42eaed3b90d02d2cdc7417d6cae189ff4ba876aa5608551afbf1fb47"
VITE_PUBLIC_ACCOUNT_CLASS_HASH="0x07dc7899aa655b0aae51eadff6d801a58e97dd99cf4666ee59e704249e51adf2"
VITE_PUBLIC_FEE_TOKEN_ADDRESS=0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
VITE_PUBLIC_TORII=https://api.cartridge.gg/x/sepolia-rc-16/torii
VITE_PUBLIC_TORII=https://api.cartridge.gg/x/sepolia-rc-17/torii
VITE_PUBLIC_NODE_URL=https://api.cartridge.gg/x/starknet/sepolia
VITE_PUBLIC_DEV=false
VITE_PUBLIC_GAME_VERSION="v1.0.0-rc7"
VITE_PUBLIC_SHOW_FPS=false
VITE_PUBLIC_GRAPHICS_DEV=false
VITE_PUBLIC_TORII_RELAY=/dns4/api.cartridge.gg/tcp/443/x-parity-wss/%2Fx%2Fsepolia-rc-16%2Ftorii%2Fwss
VITE_PUBLIC_TORII_RELAY=/dns4/api.cartridge.gg/tcp/443/x-parity-wss/%2Fx%2Fsepolia-rc-17%2Ftorii%2Fwss
VITE_SEASON_PASS_ADDRESS=0x23cc88996a5f9c7bcb559fdcffc257c0f75abe60f2a7e5d5cd343f8a95967f7
VITE_REALMS_ADDRESS=0x3205f47bd6f0b5e9cd5c79fcae19e12523a024709776d0a9e8b375adf63468d
VITE_LORDS_ADDRESS=0x0342ad5cc14002c005a5cedcfce2bd3af98d5e7fb79e9bf949b3a91cf145d72e

VITE_PUBLIC_CHAIN=sepolia
VITE_PUBLIC_SLOT=sepolia-rc-16
VITE_PUBLIC_SLOT=sepolia-rc-17

VITE_PUBLIC_CONSTRUCTION_FLAG=false
VITE_PUBLIC_HIDE_THREEJS_MENU=false
Expand Down
2 changes: 1 addition & 1 deletion client/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -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
VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
1 change: 0 additions & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://eternum.realms.world/images/og-image.png" />

</head>
<body>
<div id="root"></div>
Expand Down
Binary file added client/public/images/Eternum-Mark-Black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/public/images/apple-touch-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/public/images/favicon.ico
Binary file not shown.
Binary file modified client/public/images/maskable-icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/public/images/pwa-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/public/images/pwa-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/public/images/pwa-64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/models/buildings-opt/wonder.glb
Binary file not shown.
Binary file added client/public/models/buildings-opt/wonder2.glb
Binary file not shown.
2 changes: 1 addition & 1 deletion client/pwa-assets.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { defineConfig, minimal2023Preset } from "@vite-pwa/assets-generator/conf

export default defineConfig({
preset: minimal2023Preset,
images: ["public/images/oroborus.png"],
images: ["public/images/Eternum-Mark-Black.png"],
});
2 changes: 2 additions & 0 deletions client/src/dojo/createClientComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ export function createClientComponents({ contractComponents }: SetupNetworkResul
Population: overridableComponent(contractComponents.Population),
Resource: overridableComponent(contractComponents.Resource),
Weight: overridableComponent(contractComponents.Weight),
OwnedResourcesTracker: overridableComponent(contractComponents.OwnedResourcesTracker),
Army: overridableComponent(contractComponents.Army),
BuildingQuantityv2: overridableComponent(contractComponents.BuildingQuantityv2),
Structure: overridableComponent(contractComponents.Structure),
ArrivalTime: overridableComponent(contractComponents.ArrivalTime),
};
}
14 changes: 14 additions & 0 deletions client/src/dojo/modelManager/ArmyMovementManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useAccountStore } from "@/hooks/context/accountStore";
import useUIStore from "@/hooks/store/useUIStore";
import { type HexPosition } from "@/types";
import { FELT_CENTER } from "@/ui/config";
import {
Expand Down Expand Up @@ -263,12 +264,23 @@ export class ArmyMovementManager {
});
};

private readonly _optimisticArrivalTimeUpdate = (overrideId: string) => {
this.setup.components.ArrivalTime.addOverride(overrideId, {
entity: this.entity,
value: {
entity_id: this.entityId,
arrives_at: BigInt(useUIStore.getState().nextBlockTimestamp || 0),
},
});
};

private readonly _optimisticExplore = (col: number, row: number, currentArmiesTick: number) => {
const overrideId = uuid();

this._optimisticStaminaUpdate(overrideId, configManager.getExploreStaminaCost(), currentArmiesTick);
this._optimisticTileUpdate(overrideId, col, row);
this._optimisticPositionUpdate(overrideId, col, row);
this._optimisticArrivalTimeUpdate(overrideId);
this._optimisticCapacityUpdate(
overrideId,
// all resources you can find have the same weight as wood
Expand Down Expand Up @@ -315,6 +327,7 @@ export class ArmyMovementManager {

this._optimisticStaminaUpdate(overrideId, configManager.getTravelStaminaCost() * pathLength, currentArmiesTick);
this._optimisticFoodCosts(overrideId, TravelTypes.Travel);
this._optimisticArrivalTimeUpdate(overrideId);

this.setup.components.Position.addOverride(overrideId, {
entity: this.entity,
Expand All @@ -338,6 +351,7 @@ export class ArmyMovementManager {
this.setup.components.Stamina.removeOverride(overrideId);
this.setup.components.Resource.removeOverride(overrideId);
this.setup.components.Weight.removeOverride(overrideId);
this.setup.components.ArrivalTime.removeOverride(overrideId);
};

private readonly _optimisticFoodCosts = (overrideId: string, travelType: TravelTypes) => {
Expand Down
7 changes: 4 additions & 3 deletions client/src/dojo/modelManager/LeaderboardManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
TickIds,
WORLD_CONFIG_ID,
} from "@bibliothecadao/eternum";
import { Entity, getComponentValue, HasValue, runQuery } from "@dojoengine/recs";
import { Entity, HasValue, getComponentValue, runQuery } from "@dojoengine/recs";
import { getEntityIdFromKeys } from "@dojoengine/utils";
import { configManager } from "../setup";
import { ClientConfigManager } from "./ConfigManager";
Expand All @@ -33,15 +33,16 @@ export class LeaderboardManager {
);
if (!hyperstructure) return;

const epochIndex = hyperstructure.current_epoch - 1 >= 0 ? hyperstructure.current_epoch - 1 : 0;
const currentEpoch = getComponentValue(
this.dojoResult.setup.components.Epoch,
getEntityIdFromKeys([BigInt(hyperstructureEntityId), BigInt(hyperstructure.current_epoch)]),
getEntityIdFromKeys([BigInt(hyperstructureEntityId), BigInt(epochIndex)]),
);
if (!currentEpoch) return;

const coOwners = (currentEpoch.owners as any).map((owner: any) => {
let [owner_address, percentage] = owner.value.map((value: any) => value.value);
return { address: owner_address, percentage: Number(percentage) / 10_000 };
return { address: ContractAddress(owner_address), percentage: Number(percentage) };
});

return { coOwners, timestamp: Number(currentEpoch.start_timestamp) };
Expand Down
63 changes: 9 additions & 54 deletions client/src/dojo/modelManager/ResourceInventoryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ export class ResourceInventoryManager {
value: 0n,
},
});

// need to update this for the arrivals list to get updated
this.setup.components.OwnedResourcesTracker.addOverride(overrideId, {
entity,
value: {
resource_types: 0n,
},
});
};

public onOffloadAll = async (receiverEntityId: ID, inventoryResources: Resource[]) => {
Expand All @@ -59,61 +67,8 @@ export class ResourceInventoryManager {
.finally(() => {
this.setup.components.Resource.removeOverride(overrideId);
this.setup.components.Weight.removeOverride(overrideId);
this.setup.components.OwnedResourcesTracker.removeOverride(overrideId);
});
}
};

public onOffloadAllMultiple = async (
transfers: {
senderEntityId: ID;
recipientEntityId: ID;
resources: Resource[];
}[],
) => {
const overrideId = uuid();

// Apply optimistic updates for each transfer
transfers.forEach((transfer) => {
transfer.resources.forEach((resource) => {
const recipientEntity = getEntityIdFromKeys([BigInt(transfer.recipientEntityId), BigInt(resource.resourceId)]);
const recipientBalance = getComponentValue(this.setup.components.Resource, recipientEntity)?.balance || 0n;

this.setup.components.Resource.addOverride(overrideId, {
entity: recipientEntity,
value: {
resource_type: resource.resourceId,
balance: recipientBalance + BigInt(resource.amount),
},
});
});

// Reset weight for sender
const senderEntity = getEntityIdFromKeys([BigInt(transfer.senderEntityId)]);
this.setup.components.Weight.addOverride(overrideId, {
entity: senderEntity,
value: {
value: 0n,
},
});
});

try {
await this.setup.systemCalls.send_resources_multiple({
calls: transfers.map((transfer) => ({
sender_entity_id: transfer.senderEntityId,
recipient_entity_id: transfer.recipientEntityId,
resources: transformResources(transfer.resources),
})),
signer: useAccountStore.getState().account!,
});
} finally {
// Clean up overrides
this.setup.components.Resource.removeOverride(overrideId);
this.setup.components.Weight.removeOverride(overrideId);
}
};
}

const transformResources = (resources: Resource[]) => {
return resources.flatMap((resource) => [resource.resourceId, resource.amount]);
};
10 changes: 4 additions & 6 deletions client/src/dojo/modelManager/ResourceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,11 @@ export class ResourceManager {
if (!production) return [false, 0];

let consumptionRate = Number(production.consumption_rate);

// Check if this is a Wonder producing Lords
const isWonder = getComponentValue(
this.setup.components.Realm,
getEntityIdFromKeys([BigInt(this.entityId)])
)?.has_wonder || false;

const isWonder =
getComponentValue(this.setup.components.Realm, getEntityIdFromKeys([BigInt(this.entityId)]))?.has_wonder || false;

if (isWonder && resourceId === ResourcesIds.Lords) {
consumptionRate = consumptionRate * 0.1; // 10% of normal production rate for Wonders
}
Expand Down
6 changes: 6 additions & 0 deletions client/src/dojo/modelManager/TileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export class TileManager {
return (realm?.level || RealmLevels.Settlement) as RealmLevels;
};

getWonder = () => {
const realmEntityId = useUIStore.getState().structureEntityId;
const realm = getComponentValue(this.setup.components.Realm, getEntityIdFromKeys([BigInt(realmEntityId)]));
return realm?.has_wonder || false;
};

existingBuildings = () => {
const builtBuildings = Array.from(
runQuery([
Expand Down
Loading
Loading