Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

kurtosis-tech/zzz-deprecated-avalanche-smart-contract-sample-testsuite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example Avalanche Smart Contract Testsuite

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.

1 - Create your own repo from this repository

  1. Clone this repository to your local machine
  2. Delete the .git directory: rm -rf .git
  3. Reinitialize Git: git init
  4. Add all the files in this repo: git add .
  5. Commit: git commit -m "Initial commit"
  6. Create a new repo on Github
  7. Add your new repo as a remote: git remote add origin git@github.com:YOUR-ORG-HERE/YOUR-REPO-HERE.git
  8. Push up to your repo: git push origin

2 - Run the testsuite

  1. Install git on your machine if not done already
  2. Install docker on your machine if not done already
  3. Create a Kurtosis account here
  4. Run scripts/build-and-run.sh all, and when prompted link your device to your Kurtosis account

3 - Upload your smart contracts and regenerate the Go bindings

  1. 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 of go-ethereum):
    1. Install the command:
    2. Verify that your version is v0.7: solc --version
  2. Make the abigen binary using go-ethereum v1.9.21 on your local machine (NOTE: v1.9.21 is important for the same AvalancheGo reason):
    1. Clone the go-ethereum repo at v1.9.21: git clone --branch v1.9.21 git@github.com:ethereum/go-ethereum.git
    2. Enter the repo: cd go-ethereum
    3. Install all the binaries: go install ./...
    4. Verify that the installed abigen binary is on the correct version: $GOPATH/bin/abigen --version
  3. Inside the testsuite repo, copy your contract to smart_contracts/contract.sol
  4. Run the script to regenerate the Go bindings: scripts/regenerate-contract-bindings.sh $GOTPATH/bin/abigen

4 - Customize the testsuite

  1. Install go on your machine
  2. Install a Go IDE of your choice (we recommend GoLand by JetBrains)
  3. Open the repo directory
  4. Replace the section marked TODO REPLACE WITH YOUR TEST CODE in testsuite/testsuite_impl/smart_contract_test_.go using the bindings generated for your contracts
  5. Verify the testsuite still works: scripts/build-and-run.sh all
  6. 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

About

A testsuite for testing smart contracts on the Avalanche blockchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published