This is a WIP project of a Token-based Plasma Cash Implementations. This implementations only support ERC712 tokens. This repo corresponds to the contracts and Ethereum-related file, in the 3-repo project.
API Side Chain - https://github.com/epord/Plasma-Cash-SideChain
Front End Client - https://github.com/epord/CryptoMons-client
Ethereum Contracts - https://github.com/epord/Plasma-Cash-RootChain
The main Contract is located at contracts/Core/RootChain.sol.
You must have downloaded Truffle and Ganache-cli.
ganache-cli -p 7545 -i 5777 --gasLimit=0x1fffffffffffff --allowUnlimitedContractSize -e 1000000000. Runs Ganache on port7545,localhostand network ID5777. Add the gasLimit, allowUnlimitedContractSize to be able to deploy big contracts. If you dont want to changenpm itruffle migrate
You can use Remix and Metamask. You can also test it using our WIP client and API.
- Clone the Front-End Client
- Clone the API Side Chain
- After truffle migrate, copy json the files in build/contracts of
CrytoMons,ValidatorManagerContractandRootChaininto the Api's src/json folder (override) - Setup Metamask network (Add a custom RPC -> http://localhost:7545 network 5777)
- Import an account to Metamask using ganache's provided privateKey
- Follow the Readme in each project.
- Open
localhost:8080to use the client, make sure the API is running
- After truffle migrate, save the contract address of CryptoMon, RootChain and ValidatorManagerContract
- Setup Metamask network (Add a custom RPC -> http://localhost:7545 network 5777) with one of the chain's private keys
- Import an account to Metamask using ganache's provided privateKey
- Install truffle-flattener
- run
truffle-flattener contracts/Core/Rootchain.sol >> RootChainOut.sol - run
truffle-flattener contracts/Core/CryptoMons.sol >> CryptoMonsOut.sol - Copy RootChainOut and CryptoMonsOut into Remix
- Compile the contracts (use 0.5.2 compiler if you want to debug)
- On the
Deploy and Run Transactionstab, make sure to use Injected Web3 and select the network in Metamask - Select
CryptoMonsand AddAt Addresscopying the contract's address - Select
ValidatorManagerContractand AddAt Addresscopying the contract's address - Select
RootChainand AddAt Addresscopying the contract's address - In the
ValidatorManagerContractmake sure to setToken ofCryptMonscontract totrue - Buy a
CryptMonpaying 0.01 eth, and safeTransfer it toRootChainaddress - Your token is now deposited
Run another terminal for using the following commands
- Fast-forward time (30 days):
curl -H "Content-Type: application/json" -X POST --data '{"id":1337,"jsonrpc":"2.0","method":"evm_increaseTime","params":[2592000]}' http://localhost:7545 - Mine block in ganache
curl -H "Content-Type: application/json" -X POST --data '{"id":1337,"jsonrpc":"2.0","method":"evm_mine","params":[]}' http://localhost:7545 - Useful ganache commands:
https://github.com/trufflesuite/ganache-cli#implemented-methods