-
Notifications
You must be signed in to change notification settings - Fork 51
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
Fix/wonders lords cost #2384
Fix/wonders lords cost #2384
Changes from 24 commits
c2f937e
b644547
39ddfc0
54f5668
b2900ad
f6ffa82
8449a59
fca4da9
15dda9a
042d1fd
735600a
3de49bd
2839eda
b64cc4c
800d2fc
7024782
f681052
50196a3
1ee218d
43654f7
c5f86fd
662d5b3
3f6171c
e1092f3
e912561
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"seasonPass": "0x057675b9c0bd62b096a2e15502a37b290fa766ead21c33eda42993e48a714b80", | ||
"realms": "0x07ae27a31bb6526e3de9cf02f081f6ce0615ac12a6d7b85ee58b8ad7947a2809", | ||
"lords": "0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49" | ||
} | ||
"seasonPass": "0x057675b9c0bd62b096a2e15502a37b290fa766ead21c33eda42993e48a714b80", | ||
"realms": "0x07ae27a31bb6526e3de9cf02f081f6ce0615ac12a6d7b85ee58b8ad7947a2809", | ||
"lords": "0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,19 +124,18 @@ const setupConfig: Config = EternumGlobalConfig; | |
setupConfig.vrf.vrfProviderAddress = VITE_VRF_PROVIDER_ADDRESS!; | ||
|
||
// Bridge | ||
setupConfig.bridge = { | ||
(setupConfig.bridge = { | ||
...EternumGlobalConfig.bridge, | ||
velords_fee_recipient: BigInt('0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5'), // burner | ||
velords_fee_recipient: BigInt("0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5"), // burner | ||
season_pool_fee_recipient: BigInt(getContractByName(manifest, `${NAMESPACE}-season_systems`)), | ||
}, | ||
|
||
// Season Pass | ||
setupConfig.season = { | ||
...EternumGlobalConfig.season, | ||
seasonPassAddress: process.env.VITE_SEASON_PASS_ADDRESS!, | ||
realmsAddress: process.env.VITE_REALMS_ADDRESS!, | ||
lordsAddress: process.env.VITE_LORDS_ADDRESS!, | ||
}; | ||
}), | ||
// Season Pass | ||
(setupConfig.season = { | ||
...EternumGlobalConfig.season, | ||
seasonPassAddress: process.env.VITE_SEASON_PASS_ADDRESS!, | ||
realmsAddress: process.env.VITE_REALMS_ADDRESS!, | ||
lordsAddress: process.env.VITE_LORDS_ADDRESS!, | ||
}); | ||
Comment on lines
+133
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Environment variables are validated but documentation needs improvement The environment variables are properly validated using Zod schema in both VITE_SEASON_PASS_ADDRESS: z.string().startsWith("0x"),
VITE_REALMS_ADDRESS: z.string().startsWith("0x"),
VITE_LORDS_ADDRESS: z.string().startsWith("0x"), However, there are a few concerns:
🔗 Analysis chainVerify environment variables for season configuration. The season configuration relies on multiple environment variables without validation. Let's verify these environment variables are properly documented: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Check if these environment variables are documented
echo "Checking for environment variables documentation..."
rg -l "VITE_SEASON_PASS_ADDRESS|VITE_REALMS_ADDRESS|VITE_LORDS_ADDRESS" .env* README.md docs/
Length of output: 306 Script: #!/bin/bash
# Let's first find any .env files and documentation files in the repository
echo "Finding environment and documentation files..."
fd -t f "^\.env" -t f "^README" -t f "\.md$"
# Let's also check for environment variable usage in the codebase
echo -e "\nChecking environment variable usage..."
rg "VITE_(SEASON_PASS|REALMS|LORDS)_ADDRESS"
# Let's check if there's any validation logic for these variables
echo -e "\nChecking for validation logic..."
rg "process\.env\.VITE_(SEASON_PASS|REALMS|LORDS)_ADDRESS" -A 2 -B 2
Length of output: 5352 |
||
|
||
export const config = new EternumConfig(setupConfig); | ||
|
||
|
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
{ | ||
"STONE": [1, "0x439a1c010e3e1bb2d43d43411000893c0042bd88f6c701611a0ea914d426da4"], | ||
"COAL": [2, "0xce635e3f241b0ae78c46a929d84a9101910188f9c4024eaa7559556503c31a"], | ||
"WOOD": [3, "0x40d8907cec0f7ae9c364dfb12485a1314d84c129bf1898d2f3d4b7fcc7d44f4"], | ||
"COPPER": [4, "0x66ed5c928ee027a9419ace1cbea8389885161db5572a7c5c4fef2310e9bf494"], | ||
"IRONWOOD": [5, "0x1720cf6318bff45e62acc588680ae3cd4d5f8465b1d52cb710533c9299b031a"], | ||
"OBSIDIAN": [6, "0x3b6448d09dcd023507376402686261f5d6739455fa02f804907b066e488da66"], | ||
"GOLD": [7, "0xdff9dca192609c4e86ab3be22c7ec1e968876c992d21986f3c542be97fa2f"], | ||
"SILVER": [8, "0x6fe21d2d4a8a05bdb70f09c9250af9870020d5dcc35f410b4a39d6605c3e353"], | ||
"MITHRAL": [9, "0x67ba235c569c23877064b2ac6ebd4d79f32d3c00f5fab8e28a3b5700b957f6"], | ||
"ALCHEMICALSILVER": [10, "0x3956a5301e99522038a2e7dcb9c2a89bf087ffa79310ee0a508b5538efd8ddd"], | ||
"COLDIRON": [11, "0x555d713e59d4ff96b7960447e9bc9e79bfdeab5b0eea74e3df81bce61cfbc77"], | ||
"DEEPCRYSTAL": [12, "0x1d655ac834d38df7921074fc1588411e202b1af83307cbd996983aff52db3a8"], | ||
"RUBY": [13, "0x3d9b66720959d0e7687b898292c10e62e78626f2dba5e1909961a2ce3f86612"], | ||
"DIAMONDS": [14, "0xe03ea8ae385f64754820af5c01c36abf1b8130dd6797d3fd9d430e4114e876"], | ||
"HARTWOOD": [15, "0x5620aa7170cd66dbcbc37d03087bfe4633ffef91d3e4d97b501de906004f79b"], | ||
"IGNIUM": [16, "0x625c1f789b03ebebc7a9322366f38ebad1f693b84b2abd8cb8f5b2748b0cdd5"], | ||
"TWILIGHTQUARTZ": [17, "0x35e24c02409c3cfe8d5646399a62c4d102bb782938d5f5180e92c9c62d3faf7"], | ||
"TRUEICE": [18, "0x4485f5a6e16562e1c761cd348e63256d00389e3ddf4f5d98afe7ab44c57c481"], | ||
"ADAMANTINE": [19, "0x367f838f85a2f5e1580d6f011e4476f581083314cff8721ba3dda9706076eed"], | ||
"SAPPHIRE": [20, "0x2f8dd022568af8f9f718aa37707a9b858529db56910633a160456838b6cbcbc"], | ||
"ETHEREALSILICA": [21, "0x68b6e23cbbd58a644700f55e96c83580921e9f521b6e5175396b53ba7910e7d"], | ||
"DRAGONHIDE": [22, "0x3bf856515bece3c93f5061b7941b8645f817a0acab93c758b8c7b4bc0afa3c6"], | ||
"DEMONHIDE": [28, "0x3b847fbef9d344ba968edc945100e6ab0258a4b1b91f8665f85a3d814c3e4d4"], | ||
"EARTHENSHARD": [29, "0x1cd5b8dd341dc43a97b821bc3cdc524f941142397b787a977fbd14078cf12a4"], | ||
"DONKEY": [249, "0x264be95a4a2ace20add68cb321acdccd2f9f8440ee1c7abd85da44ddab01085"], | ||
"KNIGHT": [250, "0xac965f9e67164723c16735a9da8dbc9eb8e43b1bd0323591e87c056badf606"], | ||
"CROSSBOWMAN": [251, "0x67e4ac00a241be06ba6afc11fa2715ec7da0c42c05a67ef6ecfcfeda725aaa8"], | ||
"PALADIN": [252, "0x3bc86299bee061c7c8d7546ccb62b9daf9bffc653b1508facb722c6593874bc"], | ||
"WHEAT": [254, "0x57a3f1ee475e072ce3be41785c0e889b7295d7a0dcc22b992c5b9408dbeb280"], | ||
"FISH": [255, "0x27719173cfe10f1aa38d2aaed0a075b6077290f1e817aa3485d2b828394f4d9"], | ||
"LORDS": [253, "0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49"] | ||
} | ||
"STONE": [1, "0x439a1c010e3e1bb2d43d43411000893c0042bd88f6c701611a0ea914d426da4"], | ||
"COAL": [2, "0xce635e3f241b0ae78c46a929d84a9101910188f9c4024eaa7559556503c31a"], | ||
"WOOD": [3, "0x40d8907cec0f7ae9c364dfb12485a1314d84c129bf1898d2f3d4b7fcc7d44f4"], | ||
"COPPER": [4, "0x66ed5c928ee027a9419ace1cbea8389885161db5572a7c5c4fef2310e9bf494"], | ||
"IRONWOOD": [5, "0x1720cf6318bff45e62acc588680ae3cd4d5f8465b1d52cb710533c9299b031a"], | ||
"OBSIDIAN": [6, "0x3b6448d09dcd023507376402686261f5d6739455fa02f804907b066e488da66"], | ||
"GOLD": [7, "0xdff9dca192609c4e86ab3be22c7ec1e968876c992d21986f3c542be97fa2f"], | ||
"SILVER": [8, "0x6fe21d2d4a8a05bdb70f09c9250af9870020d5dcc35f410b4a39d6605c3e353"], | ||
"MITHRAL": [9, "0x67ba235c569c23877064b2ac6ebd4d79f32d3c00f5fab8e28a3b5700b957f6"], | ||
"ALCHEMICALSILVER": [10, "0x3956a5301e99522038a2e7dcb9c2a89bf087ffa79310ee0a508b5538efd8ddd"], | ||
"COLDIRON": [11, "0x555d713e59d4ff96b7960447e9bc9e79bfdeab5b0eea74e3df81bce61cfbc77"], | ||
"DEEPCRYSTAL": [12, "0x1d655ac834d38df7921074fc1588411e202b1af83307cbd996983aff52db3a8"], | ||
"RUBY": [13, "0x3d9b66720959d0e7687b898292c10e62e78626f2dba5e1909961a2ce3f86612"], | ||
"DIAMONDS": [14, "0xe03ea8ae385f64754820af5c01c36abf1b8130dd6797d3fd9d430e4114e876"], | ||
"HARTWOOD": [15, "0x5620aa7170cd66dbcbc37d03087bfe4633ffef91d3e4d97b501de906004f79b"], | ||
"IGNIUM": [16, "0x625c1f789b03ebebc7a9322366f38ebad1f693b84b2abd8cb8f5b2748b0cdd5"], | ||
"TWILIGHTQUARTZ": [17, "0x35e24c02409c3cfe8d5646399a62c4d102bb782938d5f5180e92c9c62d3faf7"], | ||
"TRUEICE": [18, "0x4485f5a6e16562e1c761cd348e63256d00389e3ddf4f5d98afe7ab44c57c481"], | ||
"ADAMANTINE": [19, "0x367f838f85a2f5e1580d6f011e4476f581083314cff8721ba3dda9706076eed"], | ||
"SAPPHIRE": [20, "0x2f8dd022568af8f9f718aa37707a9b858529db56910633a160456838b6cbcbc"], | ||
"ETHEREALSILICA": [21, "0x68b6e23cbbd58a644700f55e96c83580921e9f521b6e5175396b53ba7910e7d"], | ||
"DRAGONHIDE": [22, "0x3bf856515bece3c93f5061b7941b8645f817a0acab93c758b8c7b4bc0afa3c6"], | ||
"DEMONHIDE": [28, "0x3b847fbef9d344ba968edc945100e6ab0258a4b1b91f8665f85a3d814c3e4d4"], | ||
"EARTHENSHARD": [29, "0x1cd5b8dd341dc43a97b821bc3cdc524f941142397b787a977fbd14078cf12a4"], | ||
"DONKEY": [249, "0x264be95a4a2ace20add68cb321acdccd2f9f8440ee1c7abd85da44ddab01085"], | ||
"KNIGHT": [250, "0xac965f9e67164723c16735a9da8dbc9eb8e43b1bd0323591e87c056badf606"], | ||
"CROSSBOWMAN": [251, "0x67e4ac00a241be06ba6afc11fa2715ec7da0c42c05a67ef6ecfcfeda725aaa8"], | ||
"PALADIN": [252, "0x3bc86299bee061c7c8d7546ccb62b9daf9bffc653b1508facb722c6593874bc"], | ||
"WHEAT": [254, "0x57a3f1ee475e072ce3be41785c0e889b7295d7a0dcc22b992c5b9408dbeb280"], | ||
"FISH": [255, "0x27719173cfe10f1aa38d2aaed0a075b6077290f1e817aa3485d2b828394f4d9"], | ||
"LORDS": [253, "0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49"] | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,11 +2,7 @@ import { useEntities } from "@/hooks/helpers/useEntities"; | |||||||||||||||||||||
import { donkeyArrivals } from "@/hooks/helpers/useResources"; | ||||||||||||||||||||||
import { useBridgeAsset } from "@/hooks/useBridge"; | ||||||||||||||||||||||
import { displayAddress } from "@/lib/utils"; | ||||||||||||||||||||||
import { | ||||||||||||||||||||||
ADMIN_BANK_ENTITY_ID, | ||||||||||||||||||||||
RESOURCE_PRECISION, | ||||||||||||||||||||||
ResourcesIds | ||||||||||||||||||||||
} from "@bibliothecadao/eternum"; | ||||||||||||||||||||||
import { ADMIN_BANK_ENTITY_ID, RESOURCE_PRECISION, ResourcesIds } from "@bibliothecadao/eternum"; | ||||||||||||||||||||||
import { useAccount } from "@starknet-react/core"; | ||||||||||||||||||||||
import { Loader } from "lucide-react"; | ||||||||||||||||||||||
import { useMemo, useState } from "react"; | ||||||||||||||||||||||
|
@@ -38,15 +34,15 @@ export const BridgeOutStep2 = () => { | |||||||||||||||||||||
); | ||||||||||||||||||||||
|
||||||||||||||||||||||
const [resourceFees, setResourceFees] = useState< | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
id: string; | ||||||||||||||||||||||
velordsFee: string; | ||||||||||||||||||||||
seasonPoolFee: string; | ||||||||||||||||||||||
clientFee: string; | ||||||||||||||||||||||
bankFee: string; | ||||||||||||||||||||||
totalFee?: string; | ||||||||||||||||||||||
}[] | ||||||||||||||||||||||
>([]); | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
id: string; | ||||||||||||||||||||||
velordsFee: string; | ||||||||||||||||||||||
seasonPoolFee: string; | ||||||||||||||||||||||
clientFee: string; | ||||||||||||||||||||||
bankFee: string; | ||||||||||||||||||||||
totalFee?: string; | ||||||||||||||||||||||
}[] | ||||||||||||||||||||||
>([]); | ||||||||||||||||||||||
|
||||||||||||||||||||||
const { playerRealms } = useEntities(); | ||||||||||||||||||||||
const realmEntityIds = useMemo(() => { | ||||||||||||||||||||||
|
@@ -98,7 +94,9 @@ export const BridgeOutStep2 = () => { | |||||||||||||||||||||
} | ||||||||||||||||||||||
const currentDonkeyInfo = donkeyInfos?.find((donkey) => donkey.donkeyEntityId?.toString() === value); | ||||||||||||||||||||||
setDonkeyEntityId(BigInt(value)); | ||||||||||||||||||||||
setSelectedResourceIds((currentDonkeyInfo!.donkeyResources.map((resource) => resource.resourceId as never)) ?? 0); | ||||||||||||||||||||||
setSelectedResourceIds( | ||||||||||||||||||||||
currentDonkeyInfo!.donkeyResources.map((resource) => resource.resourceId as never) ?? 0, | ||||||||||||||||||||||
); | ||||||||||||||||||||||
Comment on lines
+97
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Improve type safety and error handling in resource selection. The current implementation has several issues:
Consider this safer implementation: - setSelectedResourceIds(
- currentDonkeyInfo!.donkeyResources.map((resource) => resource.resourceId as never) ?? 0,
- );
+ if (currentDonkeyInfo?.donkeyResources) {
+ setSelectedResourceIds(
+ currentDonkeyInfo.donkeyResources.map((resource) => resource.resourceId)
+ );
+ } else {
+ setSelectedResourceIds([]);
+ } 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||
setSelectedResourceAmounts({ | ||||||||||||||||||||||
[currentDonkeyInfo!.donkeyResources[0].resourceId ?? 0]: | ||||||||||||||||||||||
currentDonkeyInfo!.donkeyResources[0].amount / RESOURCE_PRECISION, | ||||||||||||||||||||||
|
@@ -147,7 +145,7 @@ export const BridgeOutStep2 = () => { | |||||||||||||||||||||
setResourceFees={setResourceFees} | ||||||||||||||||||||||
type="withdrawal" | ||||||||||||||||||||||
/> | ||||||||||||||||||||||
<div className="flex justify-between font-bold mt-3"> | ||||||||||||||||||||||
<div className="flex justify-between font-bold mt-3"> | ||||||||||||||||||||||
<div>Total Amount Received</div> | ||||||||||||||||||||||
</div> | ||||||||||||||||||||||
{Object.entries(selectedResourceAmounts).map(([id, amount]) => { | ||||||||||||||||||||||
|
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.
Avoid hardcoding wallet addresses in production code.
The bridge configuration uses a hardcoded burner address for
velords_fee_recipient
. This could be risky in production and makes the code less maintainable.Consider using an environment variable instead:
📝 Committable suggestion