@hashflow/hashverse-contracts
v1.3.1
Published
Smart Contracts to power the HashVerse.
Downloads
1,431
Readme
Running Tests
Unit Tests
- Run
yarn
to install all dependencies. - [Optional] Run
yarn hardhat compile
to ensure that contracts compile. - Run
yarn hardhat test
.
Wormhole Integration Tests
In order to test the x-chain capabilities of the Avatar and Item contracts, we need to run integration tests that simulate Wormhole message relays.
- Run
yarn
to install all dependencies. - Set up the Wormhole Local Validator, as outlined in the documentation.
- Run
npm run evm
andnpm run wormhole
to start the Wormhole Local Validator. - Run the following commands to deploy and initialize the contracts, as well as mint an Avatar and Item:
yarn hardhat test:wormhole:deploy --network wormhole1
-- deploys contracts on the main networkyarn hardhat test:wormhole:deploy --network wormhole2
-- deploys contracts on the satellite networkyarn hardhat test:wormhole:initial-setup --network wormhole1
-- initializes remotes and sprays ETHyarn hardhat test:wormhole:initial-setup --network wormhole2
-- initializes remotes and sprays ETH
- Run the following commands to mint the Avatar cross-chain:
yarn hardhat test:wormhole:avatar-mint-out --network wormhole1
-- emits a Wormhole messageyarn hardhat test:wormhole:avatar-mint-in --network wormhole2
-- mints the Avatar cross-chian
- Run the following command again and expect an error:
yarn hardhat test:wormhole:avatar-mint-in --network wormhole2
- Run the following command to send the Item cross-chain:
yarn hardhat test:wormhole:item-bridge-out --network wormhole1
-- emits a Wormhole message and burns the Itemyarn hardhat test:wormhole:item-bridge-in --network wormhole2
-- mints the Item on the satellite chainyarn hardhat test:wormhole:item-bridge-out --network wormhole2
-- emits a Wormhole message and burns the Itemyarn hardhat test:wormhole:item-bridge-in --network wormhole1
-- mints the Item on the main chainyarn hardhat test:wormhole:item-bridge-out --network wormhole1
-- emits a Wormhole message and burns the Itemyarn hardhat test:wormhole:item-bridge-in --network wormhole2
-- mints the Item on the satellite chain