Awesome
kickstark
An ERC20 crowdfund implementation on StarkNet, inspired by Solidity By Example.
Disclaimer: This code is not intended for production use and has not been audited or tested thoroughly. It is not an exact 1-1 implementation
Crowd fund ERC20 token:
-
User creates a campaign.
-
Users can pledge, transferring their token to a campaign.
-
After the campaign ends, campaign creator can claim the funds if total amount pledged is more than the campaign goal.
-
Otherwise, campaign did not reach it's goal, users can withdraw their pledge.
Setup
python3.7 -m venv venv
source venv/bin/activate
python -m pip install cairo-nile
nile install
Test
In this repo I made a small change to Makefile
to enforce usage of @pytest.mark.asyncio
and @pytest.asyncio.fixture
to suppress warnings regarding pytest-asyncio usage.
The tests mostly test the happy paths and only a few unhappy paths. There could definitely be more work done on testing the unhappy paths.
test :; pytest tests/ --asyncio-mode=strict
Run tests:
make test
Acknowledgements
Here are some acknowledgements for people who wrote very helpful resources that I referred to while learning:
sambarnes, for their work on cairo-dutch, used it extensively as a reference
perama for their notes on Cairo
RoboTeddy for their notes on Practical StarkNet lessons learned