Test on Godwoken testnet
To run contract tests on Godwoken testnet_v1, you can follow the command lines below:
git clone https://github.com/godwokenrises/godwoken-tests
- Clone Godwoken Testscd godwoken-tests/contracts
- Go to contracts foldernpm install
- Install dependenciesnpm run test:gw_testnet_v1
- Run tests on Godwoken testnet_v1
If you wish to run tests on devnet instead of testnet, please read the current section.
First, you need to install Godwoken-Kicker, and then deploy a local devnet_v1:
git clone https://github.com/godwokenrises/godwoken-kicker
- Clone Godwoken Kickercd godwoken-kicker
- Go to kicker tool’s folder./kicker start
- Deploy and start a devnet_v1 in localhost network
The deployment will take some time to complete, and for more detailed about how to start devnet in your localhost network, please read this: Deploy Local Network of Godwoken.
After the devnet started, you should deposit some testing capacity of testing accounts from layer 1 (CKB devnet) to layer 2 (Godwoken devnet):
./kicker deposit 0x966b30e576a4d6731996748b48dd67c94ef29067 10000
./kicker deposit 0x4fef21f1d42e0d23d72100aefe84d555781c31bb 10000
NOTE: Once the deposit commands have been completed, please wait 15 seconds before proceeding. Godwoken will need some time to consume and confirm deposit requests.
After deposition, you can follow the command-lines below to install Godwoken-Tests in your local environment, and run contract tests on devnet_v1:
git clone https://github.com/godwokenrises/godwoken-tests
- Clone Godwoken Testscd godwoken-tests/contracts
- Go to contracts foldernpm install
- Install dependenciesnpm run test
- Run tests on Godwoken devnet
Testing accounts are defined in contracts/hardhat.config.js.
If you prefer using your own accounts for testing, you can replace them in the source code, or run test commands with environment variables, for example:
PRIVATE_KEY=<YOUR_KEY> npm run test