This guide will walk you through the process of building contracts for the gate keeper, deploying them into an existing world running in Docker, and testing their functionality by executing scripts.
The gate keeper allows you to crowdfund items toward a specific goal. For example, if you need a certain amount of resources to build a new ship for the corporation etc.
Previously, in the game gate keeper was used to have shared goals for players to contribute salt. Once the goals were met, gates and new areas were unlocked.
First, copy the World Contract Address from the Docker logs obtained in the previous step, then run the following command:
cd gate-keeper/packages/contracts
Install the dependecies for the contracts:
pnpm install
Local Deployment This will deploy the contracts to your local world.
pnpm run deploy:local --worldAddress <worldAddress>
Devnet Deployment This will deploy the contracts to the Devnet world. You can retrieve the world address through https://blockchain-gateway-oblivion.nursery.reitnorf.com/config and then replace with the world address.
pnpm run deploy:devnet --worldAddress <worldAddress>
eg: pnpm run deploy:local --worldAddress 0xafc8e4fd5eee66590c93feebf526e1aa2e93c6c3
Once the deployment is successful, you'll see a screen similar to the one below. This process deploys the Gate Keeper contract.
Next, replace the following values in the .env file with the values you copied earlier:
If you are on Devnet, then you can get your SSU_ID through
#WORLD ADDRESS COPIED FROM DOCKER LOGS
WORLD_ADDRESS=
#DONT NEED TO CHANGE IF YOUR RUNNING LOCALLY
SSU_ID=
You can adjust the remaining values in the .env file as needed, though they are optional.
Changing optional environment values
You can set the item you want to crowdfund and the quantity for the goal.
#Item for the goal
INVENTORY_ITEM_ID=1135
#Quantity needed to reach the goal
TARGET_QUANTITY=10
To generate mock data for testing the Gate Keeper logic on the local world, run the following command:
pnpm run mock-data
This will create the on-chain SSU, fuel it and bring it online. This SSU will then act as a gate keeper, which has to be online to recieve items for the set goal.
To configure which items should be recieved and the target amount, run:
pnpm run configure-gate-keeper
You can adjust the values for the SSU_ID, INVENTORY_ITEM_ID & TARGET_QUANTITY in the .env file as needed, though they are optional.
To test the gate keeper, execute the following command:
pnpm run deposit-to-ssu
If you encounter any issues, refer to the troubleshooting tips below:
-
World Address Mismatch: Double-check that the
WORLD_ADDRESS
is correctly updated in thecontracts/.env
file. Make sure you are deploying contracts to the correct world. -
Anvil Instance Conflicts: Ensure there is only one running instance of Anvil. The active instance should be initiated via the
docker compose up -d
command. Multiple instances of Anvil may cause unexpected behavior or deployment errors. -
Item Limits: Be cautious not to attempt depositing more items than have been generated via the
mock-data
script. The number of available items is controlled byMockSsuData.s.sol
, so ensure this script has been properly executed. The default number generated is 15, however you can change this as needed.