Treaty is a fully on-chain 4X strategy game. In Treaty, players are able to express and enforce social contracts (i.e. treaties) through code.
This repository contains the core smart contracts, tests, and deployment code for the game.
For more details, see Treaty Technical Overview from our blog.
contractsdirectory contains game smart contracts using the Diamond standard.tasksdirectory contains game constants, map generation, and deployment-related code.testdirectory contains tests for contracts using Foundry.
To use, first follow the following steps:
-
Install Foundry, a modular toolkit for Ethereum applications, here.
-
Clone this codebase.
-
Run
yarn installto install dependencies. -
Run
git submodule update --init --recursiveto install all submodules. -
Run
yarn link curio-vaultto link the vault repo needed for some data structures.
Then, to deploy the contracts locally:
-
Adjust parameters in
tasks/constants.ts. -
Spin up a local network using
npx hardhat node. -
In a separate terminal, deploy using
npx hardhat deploy.
To run Foundry tests, simply run yarn ft.
Creating your own treaty is simple! Go to contracts/treaties folder and create MyTreaty.sol:
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {CurioTreaty} from "contracts/standards/CurioTreaty.sol";
import {CurioERC20} from "contracts/standards/CurioERC20.sol";
contract MyTreaty is CurioTreaty {
...
}
We will soon add more support for you to use your custom treaties in game or to improve the core contracts. For now, join our Discord to discuss new features, treaties, or changes.
Curio Research is an on-chain gaming lab. Visit our website and Twitter for more information about us.
Join our Discord to get support and connect with the community!
Treaty is licensed under MIT.
