ExPlasma
TODO: Add description
(ExPlasma)[] is an elixir client library to interact with the OmiseGO Plasma contracts.
Installation
If available in Hex, the package can be installed
by adding ex_plasma to your list of dependencies in mix.exs:
def deps do
[
{:ex_plasma, "~> 0.1.0"}
]
endYou will also need to specify some configurations in your config/config.exs:
config :ex_plasma,
authority_address: "0x22d491bde2303f2f43325b2108d26f1eaba1e32b",
contract_address: "0xd17e1233a03affb9092d5109179b43d6a8828607",
eth_vault_address: "0x1967d06b1faba91eaadb1be33b277447ea24fa0e",
exit_game_address: "0x902719f192aa5240632f704aa7a94bab61b86550",
gas: 1_000_000,
gas_price: 1_000_000,
standard_exit_bond_size: 14_000_000_000_000_000,
eip_712_domain: [
name: "ExPlasma",
salt: "some-salt",
verifying_contract: "contract_address",
version: "1"
]Setup (Mac OS)
-
Clone the repo to your desktop
git@github.com:omisego/ex_plasma.git -
Run
mix compilein your terminal. -
If there are any unavailable dependencies, run
mix deps.get. If you run into any issues withlibsecp256k1_source, runbrew install automake pkg-config libtool libffi gmpin your terminal.
Testing
You can run the tests by running;
mix test
mix credo
mix dialyzerexvcr
The test suite has network requests recorded by exvcr. To record new cassettes, spin up docker:
docker-compose upOr alternatively, you can use the make command to spin up a detached docker compose.
make up # docker-compose detached
make logs # connects to logs from docker-composeThis will load up Ganche and the plasma contracts to deploy.
Conformance test
To ensure we can encode/decode according to the contracts, we have a separate suite of conformance tests that loads up mock contracts to compare encoding results. You can run the test by:
make up-mocks
mix test --only conformanceThis will spin up ganache and deploy the mock contracts.
Integration test
We also have more integrated flows we need to test, such as the exit game. These use live interactions with the plasma framework contracts. To run those, you can execute:
make up
mix test --only integrationThis will spin up ganache and deploy the plasma framework and run the integration suite.
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_plasma.