Welcome to the Magmo mono-repo, home of several proof-of-concept applications built on our state channel protocols.
For more information
On our website you will find links to our whitepapers and contact information. Whether you simply want to try out our apps, or get involved more deeply we would love to hear your thoughts. Deployed versions of our games may be accessed with these links:
Setting up development environment and running a game application
You will need
yarn installed (see here for instructions). After cloning the code,
In the top directory, run
npx lerna bootstrap.
Start ganache by running
yarn ganache:startin one of the package directories.
(In a new shell) Run the wallet via
yarn startin the
(In a new shell) Run a game (either RPS or TTT) via
yarn startin the relevant package directory.
Add MetaMask to your browser, and point it to
localhost:3001to view the application. You will need to import one of our (testnet-only) seed accounts into metamask to have funds to transact.
- Open the metamask browser extension
- Click on the account icon (circle in the top right)
- Select "Import"
- Paste in one of these secret keys.
You may visit the app in two different browsers in order to play against yourself. We use Redux DevTools to develop and test our apps.
All default configuration values are located in the
These can be overridden by adding a
.env.production.local and specifying values there.
To run storybook
We use Storybook to view our react components during development. You can start Storybook by running:
in the relevant package directory. This will fire up the Storybook panel inside a browser.
To create an optimized production build:
Optionally override the
TARGET_NETWORKby setting the value in your
.env.production.localfile. Otherwise the application will be built against the ropsten test network.
Build the application:
yarn run build
To deploy smart contracts
- Add test eth to your account for the deployment using an eth faucet: https://faucet.ropsten.be/ or https://faucet.metamask.io.
.env.localfile to the network you want to deploy to: either
- Deploy the contracts to the network:
yarn deployContractsAlternatively, simply run, e.g.
TARGET_NETWORK=ropsten yarn deployContracts.
Running Tests specific to a certain app
From the relevant subdirectory...
- To run application tests in watch mode:
- To run smart contract tests:
- To run all tests relating (before submitting a PR):
- To update dependencies:
npx lerna bootstrap
- To add a dependency:
npx lerna add [dependency name] --scope=[target package]
This installs the latest version of the dependency to the target package (ttt, rps or wallet). Use
--dev flag to add the new package to
devDependencies instead of
- To update the version of a dependency:
yarn upgrade [package-name@version-number]
We are working hard to produce documenation for our applications. In the interim, please see our Developer Handbook, which as some of the hints and tips
for developing on ethereum that we have used to develop our apps. You will also find some information in the
/notes/ subdirectory of each app.
Frequently, problems can be sorted by one or more of the following steps:
- Resetting your MetaMask account (i.e. deleting transaction history), or simply switching to a different network and back again.
- Restarting ganache
npx lerna bootstrapif you changed any dependencies
Otherwise, please check issues, someone else may have had the same experience. You may find a solution -- if not, please add to or create an issue.
We welcome contributions! If you want to contribute, you should be aware of the following conventions:
Prettier is configured via
Tests will fail if code does not satisfy the rules specificied in
We suggest that you configure your editor to auto-format using prettier,
or that you run it in a pre-commit git hook.
You can also run
- Directories and files should be kebab-cased.
// ok foo/bar/foo-bar/foo-bar.ts // ok foo/bar/foo-bar/foo-bar.tsx // tslint error foo/bar/foo-bar/fooBar.ts // tslint error foo/bar/foo-bar/FooBar.tsx // no tslint error, but please avoid this foo/bar/fooBar/foo-bar.svg // no tslint error, but please avoid this foo/bar/foo-bar/FooBar.svg