This testsuite demonstrates using Kurtosis to test functionality of a smart contract deployed on the Avalanche network C-Chain.
Kurtosis docs are available here, and the team is available on Discord.
- Clone this repository to your local machine
- Delete the
.git
directory:rm -rf .git
- Reinitialize Git:
git init
- Add all the files in this repo:
git add .
- Commit:
git commit -m "Initial commit"
- Create a new repo on Github
- Add your new repo as a remote:
git remote add origin git@github.com:YOUR-ORG-HERE/YOUR-REPO-HERE.git
- Push up to your repo:
git push origin
- Install
git
on your machine if not done already - Install
docker
on your machine if not done already - Create a Kurtosis account here
- Run
scripts/build-and-run.sh all
, and when prompted link your device to your Kurtosis account
- Install
solc
v0.7 on your machine (NOTE: not v0.8, which is the latest! This requirement is because the AvalancheGo client depends on an old version ofgo-ethereum
):- Install the command:
- On Mac, this can be done via
brew tap ethereum/ethereum && brew install solidity@7
- On Linux, (untested) guidance is here: https://docs.soliditylang.org/en/v0.8.0/installing-solidity.html#linux-packages
- On Mac, this can be done via
- Verify that your version is v0.7:
solc --version
- Install the command:
- Make the
abigen
binary usinggo-ethereum
v1.9.21 on your local machine (NOTE: v1.9.21 is important for the same AvalancheGo reason):- Clone the
go-ethereum
repo at v1.9.21:git clone --branch v1.9.21 git@github.com:ethereum/go-ethereum.git
- Enter the repo:
cd go-ethereum
- Install all the binaries:
go install ./...
- Verify that the installed
abigen
binary is on the correct version:$GOPATH/bin/abigen --version
- Clone the
- Inside the testsuite repo, copy your contract to
smart_contracts/contract.sol
- Run the script to regenerate the Go bindings:
scripts/regenerate-contract-bindings.sh $GOTPATH/bin/abigen
- Install
go
on your machine - Install a Go IDE of your choice (we recommend GoLand by JetBrains)
- Open the repo directory
- Replace the section marked
TODO REPLACE WITH YOUR TEST CODE
intestsuite/testsuite_impl/smart_contract_test_.go
using the bindings generated for your contracts - Verify the testsuite still works:
scripts/build-and-run.sh all
- Add more tests as you please
- The Testsuite Customization docs page provides a step-by-step walkthrough to customizing a testsuite
- The Lib Documentation docs page provides comprehensive documentation of all the Kurtosis components you'll encounter