frontier-tribe-gate/scripts/ConfigureGate.s.sol

28 lines
1.2 KiB
Solidity
Raw Permalink Normal View History

pragma solidity ^0.8.24;
import {console} from "forge-std/src/console.sol";
import {Script} from "forge-std/src/Script.sol";
import {StoreSwitch} from "@latticexyz/store/src/StoreSwitch.sol";
import {ResourceId} from "@latticexyz/store/src/ResourceId.sol";
import {WorldResourceIdLib} from "@latticexyz/world/src/WorldResourceId.sol";
import {RESOURCE_SYSTEM} from "@latticexyz/world/src/worldResourceTypes.sol";
import {SmartGateSystem, smartGateSystem} from "@eveworld/world-v2/src/namespaces/evefrontier/codegen/systems/SmartGateSystemLib.sol";
contract ConfigureSmartGate is Script {
function run(uint256 smartGateId) public {
address worldAddress = vm.envAddress("WORLD_ADDRESS");
string memory namespace = vm.envString("MUD_NAMESPACE");
StoreSwitch.setStoreAddress(worldAddress);
ResourceId systemId = WorldResourceIdLib.encode({
typeId: RESOURCE_SYSTEM,
namespace: bytes14(bytes(namespace)),
name: "TribeGateSystem"
});
console.logBytes32(systemId.unwrap());
vm.startBroadcast();
smartGateSystem.configureGate(smartGateId, systemId);
vm.stopBroadcast();
}
}