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
27 changes: 27 additions & 0 deletions script/DeployRiseTestnet.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import {Script} from "forge-std/Script.sol";
import {console2} from "forge-std/console2.sol";
import {Delveworn} from "../src/Delveworn.sol";
import {LegacyVRFAdapter} from "../src/adapters/LegacyVRFAdapter.sol";

/// @notice Deploys Delveworn on RISE Testnet behind the compatibility VRF adapter.
/// @dev RISE_VRF_COORDINATOR must point to the existing RISE VRF-style coordinator/provider contract.
contract DeployRiseTestnet is Script {
function run() external returns (LegacyVRFAdapter adapter, Delveworn dungeon) {
address upstreamCoordinator = vm.envAddress("RISE_VRF_COORDINATOR");
require(upstreamCoordinator != address(0), "Invalid RISE VRF coordinator");

vm.startBroadcast();

adapter = new LegacyVRFAdapter(upstreamCoordinator);
dungeon = new Delveworn(address(adapter));

vm.stopBroadcast();

console2.log("RISE upstream VRF coordinator:", upstreamCoordinator);
console2.log("LegacyVRFAdapter:", address(adapter));
console2.log("Delveworn:", address(dungeon));
}
}
40 changes: 40 additions & 0 deletions scripts/deploy-rise-testnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euo pipefail

RPC_URL="${RISE_RPC_URL:-https://testnet.riselabs.xyz}"
CURRENT_DUNGEON="${RISE_EXISTING_DUNGEON_ADDRESS:-}"

if [[ -z "$CURRENT_DUNGEON" && -f ../frontend/.env.local ]]; then
CURRENT_DUNGEON="$(sed -n 's/^NEXT_PUBLIC_DUNGEON_ADDRESS=//p' ../frontend/.env.local | tail -n 1 | tr -d "'\"[:space:]")"
fi

if [[ -z "$CURRENT_DUNGEON" ]]; then
cat >&2 <<'EOF'
Could not determine the existing RISE dungeon address.
Set RISE_EXISTING_DUNGEON_ADDRESS or keep NEXT_PUBLIC_DUNGEON_ADDRESS in ../frontend/.env.local.
EOF
exit 1
fi

CURRENT_DUNGEON="$(cast to-check-sum-address "$CURRENT_DUNGEON")"

echo "Existing RISE dungeon: $CURRENT_DUNGEON"
echo "Reading its coordinator from $RPC_URL ..."

RISE_VRF_COORDINATOR="$(cast call "$CURRENT_DUNGEON" 'coordinator()(address)' --rpc-url "$RPC_URL")"
RISE_VRF_COORDINATOR="$(cast to-check-sum-address "$RISE_VRF_COORDINATOR")"
export RISE_VRF_COORDINATOR

echo "RISE VRF coordinator: $RISE_VRF_COORDINATOR"
echo "Deploying fresh LegacyVRFAdapter + Delveworn V2 ..."

forge script script/DeployRiseTestnet.s.sol:DeployRiseTestnet \
--rpc-url "$RPC_URL" \
--broadcast \
"$@"

cat <<'EOF'

Deployment broadcast completed.
Use the Delveworn address printed above as NEXT_PUBLIC_DUNGEON_ADDRESS in the frontend/Vercel deployment, then redeploy the frontend.
EOF