diff --git a/client/src/ui/layouts/World.tsx b/client/src/ui/layouts/World.tsx
index 1817fc8dd..e23211191 100644
--- a/client/src/ui/layouts/World.tsx
+++ b/client/src/ui/layouts/World.tsx
@@ -19,6 +19,7 @@ import { ADMIN_BANK_ENTITY_ID } from "@bibliothecadao/eternum";
import { getComponentValue } from "@dojoengine/recs";
import { getEntityIdFromKeys } from "@dojoengine/utils";
import { env } from "../../../env";
+import { rewards } from "../components/navigation/Config";
import { IS_MOBILE } from "../config";
import { LoadingOroborus } from "../modules/loading-oroborus";
import { LoadingScreen } from "../modules/LoadingScreen";
@@ -251,6 +252,11 @@ export const World = ({ backgroundImage }: { backgroundImage: string }) => {
fetch();
}, []);
+ const openPopup = useUIStore((state) => state.openPopup);
+ useEffect(() => {
+ openPopup(rewards);
+ }, []);
+
const battleViewContent = useMemo(
() => (
diff --git a/client/src/ui/modules/rewards/Rewards.tsx b/client/src/ui/modules/rewards/Rewards.tsx
index 01ab91d9b..f6c6d230d 100644
--- a/client/src/ui/modules/rewards/Rewards.tsx
+++ b/client/src/ui/modules/rewards/Rewards.tsx
@@ -16,7 +16,8 @@ import { shortString } from "starknet";
import { formatEther } from "viem";
import { env } from "../../../../env";
-const REGISTRATION_DELAY = 1800; // 1 week
+const REGISTRATION_DELAY = 60 * 60 * 24 * 4; // 4 days
+const BRIDGE_OUT_DELAY = 60 * 60 * 24 * 2; // 2 days
export const Rewards = () => {
const {
@@ -35,6 +36,8 @@ export const Rewards = () => {
const [timeRemaining, setTimeRemaining] = useState
("");
const [isLoading, setIsLoading] = useState(false);
+ const [registrationTimeRemaining, setRegistrationTimeRemaining] = useState("");
+ const [bridgeOutTimeRemaining, setBridgeOutTimeRemaining] = useState("");
const prizePool = usePrizePool();
const togglePopup = useUIStore((state) => state.togglePopup);
@@ -77,15 +80,24 @@ export const Rewards = () => {
if (gameEnded) {
const calculateTimeRemaining = () => {
const currentTime = Math.floor(Date.now() / 1000);
- const endTime = Number(gameEnded.timestamp + REGISTRATION_DELAY);
-
- if (currentTime >= endTime) {
- setTimeRemaining("Registration Closed");
- return;
+ const registrationEndTime = Number(gameEnded.timestamp + REGISTRATION_DELAY);
+ const bridgeOutEndTime = Number(gameEnded.timestamp + BRIDGE_OUT_DELAY);
+
+ // Calculate registration time
+ if (currentTime >= registrationEndTime) {
+ setRegistrationTimeRemaining("Registration Closed");
+ } else {
+ const registrationDifference = registrationEndTime - currentTime;
+ setRegistrationTimeRemaining(formatTime(registrationDifference, undefined));
}
- const difference = endTime - currentTime;
- setTimeRemaining(formatTime(difference, undefined));
+ // Calculate bridge out time
+ if (currentTime >= bridgeOutEndTime) {
+ setBridgeOutTimeRemaining("Bridge Out Closed");
+ } else {
+ const bridgeOutDifference = bridgeOutEndTime - currentTime;
+ setBridgeOutTimeRemaining(formatTime(bridgeOutDifference, undefined));
+ }
};
calculateTimeRemaining();
@@ -135,10 +147,19 @@ export const Rewards = () => {
{Number(formatEther(prizePool)).toFixed(2)} $LORDS
-
+
+
+
+
+
+
Time left to register
+
{registrationTimeRemaining}
+
+
+
-
Time left to register
-
{timeRemaining}
+
Time left to bridge out
+
{bridgeOutTimeRemaining}
@@ -184,9 +205,9 @@ export const Rewards = () => {
);
};
-const Compartment = ({ children }: { children: React.ReactNode }) => {
+const Compartment = ({ children, isCountdown }: { children: React.ReactNode; isCountdown?: boolean }) => {
return (
-
+
{children}
);
diff --git a/contracts/src/systems/hyperstructure/contracts.cairo b/contracts/src/systems/hyperstructure/contracts.cairo
index a32c82168..da3c35725 100644
--- a/contracts/src/systems/hyperstructure/contracts.cairo
+++ b/contracts/src/systems/hyperstructure/contracts.cairo
@@ -39,6 +39,7 @@ trait IHyperstructureSystems
{
mod hyperstructure_systems {
use achievement::store::{Store, StoreTrait};
use core::array::ArrayIndex;
+ use core::poseidon::poseidon_hash_span;
use dojo::event::EventStorage;
use dojo::model::ModelStorage;
@@ -596,10 +597,16 @@ mod hyperstructure_systems {
let (hyperstructure_entity_id, index) = *hyperstructure_shareholder_epochs.at(i);
// ensure we don't double count points for the same hyperstructure
- if points_already_added.get(hyperstructure_entity_id.into()) {
- panic!("points already added for hyperstructure {}", hyperstructure_entity_id);
+
+ let points_already_added_key: felt252 = poseidon_hash_span(
+ array![hyperstructure_entity_id.into(), index.into()].span()
+ );
+
+ if points_already_added.get(points_already_added_key) {
+ panic!("points already added for hyperstructure {}, epoch {}", hyperstructure_entity_id, index);
};
- points_already_added.insert(hyperstructure_entity_id.into(), true);
+
+ points_already_added.insert(points_already_added_key, true);
let epoch: Epoch = world.read_model((hyperstructure_entity_id, index));
let next_epoch: Epoch = world.read_model((hyperstructure_entity_id, index + 1));
diff --git a/landing/src/dojo/setup.ts b/landing/src/dojo/setup.ts
index d410857dd..368a77a0f 100644
--- a/landing/src/dojo/setup.ts
+++ b/landing/src/dojo/setup.ts
@@ -5,6 +5,7 @@ import { createClientComponents } from "./createClientComponents";
import { createSystemCalls } from "./createSystemCalls";
import { ClientConfigManager } from "./modelManager/ConfigManager";
import { setupNetwork } from "./setupNetwork";
+import { getEvents } from "@dojoengine/state";
export type SetupResult = Awaited>;
export const configManager = ClientConfigManager.instance();
@@ -36,9 +37,9 @@ export async function setup({ ...config }: DojoConfig) {
const filteredEvents = [
"BurnDonkey",
// points
- "HyperstructureCoOwnersChange",
- "HyperstructureFinished",
- "GameEnded",
+ // "HyperstructureCoOwnersChange",
+ // "HyperstructureFinished",
+ // "GameEnded",
];
const clauses: Clause[] = [
@@ -87,6 +88,7 @@ export async function setup({ ...config }: DojoConfig) {
const sync = await syncEntities(network.toriiClient, filteredModels as any, [], false);
+ */
const eventSync = getEvents(
network.toriiClient,
network.contractComponents.events as any,
@@ -101,7 +103,7 @@ export async function setup({ ...config }: DojoConfig) {
false,
false,
);
-*/
+
configManager.setDojo(components);
return {
@@ -109,6 +111,6 @@ export async function setup({ ...config }: DojoConfig) {
components,
systemCalls,
//sync,
- /*eventSync,*/
+ eventSync,
};
}