Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ npm run build # tsc → dist/ (or `npm run build:bin` to refresh the bu
"env": {
"PRIVATE_KEY": "0xYOUR_PRIVATE_KEY",
"RPC_URL": "https://mainnet-rpc.gravity.xyz",
"ROUTER_ADDRESS": "0x4c2F6C0BAd768A75a67949b35feb094BAC4De03a",
"ROUTER_ADDRESS": "0x13860c81003e1d11E8C8576F995a68b02c750A59",
"CHAIN_ID": "127001"
}
}
Expand Down
19 changes: 16 additions & 3 deletions contracts/script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import "../src/ArenaEngine.sol";
import "../src/Router.sol";

contract DeployScript is Script {
uint256 constant GRAVITY_MAINNET_CHAIN_ID = 127001;

function run() external {
uint256 deployerKey = vm.envUint("PRIVATE_KEY");
address operator = vm.envAddress("OPERATOR_ADDRESS");
Expand Down Expand Up @@ -119,9 +121,20 @@ contract DeployScript is Script {
Router(address(routerProxy)).setGTreasury(address(treasuryProxy));
Router(address(routerProxy)).setCardLedger(address(cardLedgerProxy));

uint8[4] memory seedStats = [uint8(5), 5, 5, 5];
(uint256 seedAgentId, ) = engine.createAgent("MarketSeed", "arena market maker", seedStats, operator);
ArenaEngine(address(arenaProxy)).bootstrapMarket(seedAgentId);
// Mainnet runs a full-backing G economy: no free faucet, G is withdrawable.
// bootstrapMarket faucet-mints unbacked G, so it is skipped on mainnet; the
// treasury is switched to withdraw mode instead. Testnet/anvil keep the faucet
// and seeded market.
uint256 seedAgentId = 0;
if (block.chainid == GRAVITY_MAINNET_CHAIN_ID) {
// faucet OFF first — setWithdrawEnabled requires !faucetEnabled.
GTreasury(address(treasuryProxy)).setFaucetEnabled(false);
GTreasury(address(treasuryProxy)).setWithdrawEnabled(true);
} else {
uint8[4] memory seedStats = [uint8(5), 5, 5, 5];
(seedAgentId, ) = engine.createAgent("MarketSeed", "arena market maker", seedStats, operator);
ArenaEngine(address(arenaProxy)).bootstrapMarket(seedAgentId);
}

// ──── Initialize World Bible ────
engine.initWorldBible();
Expand Down
2 changes: 1 addition & 1 deletion frontend/config/gravity-mainnet.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"rpc_url": "https://mainnet-rpc.gravity.xyz",
"wss_url": "",
"chain_id": 127001,
"router_address": "0x4c2F6C0BAd768A75a67949b35feb094BAC4De03a",
"router_address": "0x13860c81003e1d11E8C8576F995a68b02c750A59",
"explorer_url": "https://mainnet-explorer.gravity.xyz"
}
2 changes: 1 addition & 1 deletion frontend/config/gravity.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"rpc_url": "https://mainnet-rpc.gravity.xyz",
"wss_url": "",
"chain_id": 127001,
"router_address": "0x4c2F6C0BAd768A75a67949b35feb094BAC4De03a",
"router_address": "0x13860c81003e1d11E8C8576F995a68b02c750A59",
"explorer_url": "https://mainnet-explorer.gravity.xyz"
}
5 changes: 3 additions & 2 deletions frontend/src/hooks/useArenaEngine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useRef } from 'react';
import { JsonRpcProvider, Contract, EventLog } from 'ethers';
import { JsonRpcProvider, Contract, EventLog, formatUnits } from 'ethers';
import { useGameStore } from '../store/useGameStore';
import { useArenaStore, ArenaGhost, ArenaMatch, ArenaSimulation } from '../store/useArenaStore';
import { getActiveNetwork } from '../lib/networks';
Expand Down Expand Up @@ -340,7 +340,8 @@ export function useArenaEngine() {
agentIds.forEach((aId, i) => {
const id = Number(aId);
tierOf[id] = Number(tiers[i]) as 0 | 1 | 2;
if (hasGTreasury) gOf[id] = Number(gBalances[i]);
// gBalance is wei-denominated on-chain (1 G = 1e18); show whole-G.
if (hasGTreasury) gOf[id] = Number(formatUnits(gBalances[i], 18));
});
} catch { /* pre-#33 arena — leave tier/G unset */ }

Expand Down
1,348 changes: 736 additions & 612 deletions mcp-server/bin/gravity-town-mcp.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mcp-server/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ChainClient, ChainConfig } from "./chain.js";
function getConfig(): ChainConfig {
const rpcUrl = process.env.RPC_URL || "https://mainnet-rpc.gravity.xyz";
const privateKey = process.env.PRIVATE_KEY;
const routerAddress = process.env.ROUTER_ADDRESS || "0x4c2F6C0BAd768A75a67949b35feb094BAC4De03a";
const routerAddress = process.env.ROUTER_ADDRESS || "0x13860c81003e1d11E8C8576F995a68b02c750A59";

if (!privateKey) throw new Error("PRIVATE_KEY env var required");

Expand Down
2 changes: 1 addition & 1 deletion mcp-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { registerTools, ToolOptions } from "./tools.js";
function getConfig(): ChainConfig {
const rpcUrl = process.env.RPC_URL || "https://mainnet-rpc.gravity.xyz";
const privateKey = process.env.PRIVATE_KEY;
const routerAddress = process.env.ROUTER_ADDRESS || "0x4c2F6C0BAd768A75a67949b35feb094BAC4De03a";
const routerAddress = process.env.ROUTER_ADDRESS || "0x13860c81003e1d11E8C8576F995a68b02c750A59";

if (!privateKey) throw new Error("PRIVATE_KEY env var required");

Expand Down
2 changes: 1 addition & 1 deletion skills/gravity-town/references/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The **only required** environment variable is your wallet key:
| --- | --- | --- |
| `PRIVATE_KEY` | **yes** | — your `0x…` wallet key, **funded with G** on Gravity L1; this is your in-game owner |
| `RPC_URL` | no | `https://mainnet-rpc.gravity.xyz` |
| `ROUTER_ADDRESS` | no | `0x4c2F6C0BAd768A75a67949b35feb094BAC4De03a` (resolves every other contract on-chain) |
| `ROUTER_ADDRESS` | no | `0x13860c81003e1d11E8C8576F995a68b02c750A59` (resolves every other contract on-chain) |
| `CHAIN_ID` | no | `127001` |

So in practice you only ever set `PRIVATE_KEY`. Everything else defaults to **Gravity Mainnet**.
Expand Down
Loading