This repo contains highly experimental code. Expect rapid iteration.
This repository contains the code for starknet smart contracts:
- contributions: The list of contributions
Install protostar version 0.2.1 or above.
curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash
protostar test
or use Protostar Test Explorer vscode extension.
First, you need to have an OpenZeppelin-compatible account deployed on the target network. This can be done with Braavos.
Add the account address, public key and private key to the ~/.starknet_accounts/starknet_open_zeppelin_accounts.json
file,
under an alias of your choice (eg. local_admin
or staging_admin
).
Then, just execute the deploy script:
./scripts/deploy.sh -a local_admin -p local
This script will look for a build/deployed_contracts.txt file to get what is already deployed.
Once the deployments are done, the build/deployed_contracts.txt file is created/updated accordingly.
If you want to re-deploy something, just remove the corresponding line from build/deployed_contracts.txt and run the script again.
To perform end-to-end testing in the marketplace-backend, we need to create a starknet-devnet
dump file with all the necessary contracts deployed.
Note: specify the BASE_TAG
to be used depending on your CPU (latest
or latest-arm
)
cd scripts/docker
DUMP_PATH=$MARKETPLACE_BACKEND_ROOT/scripts/docker/dev BASE_TAG=latest-arm docker-compose up --build -d
With the --seed 0
option, a list of 10 accounts have been deployed.
Those accounts will be used as follow:
Account #0 : Admin
Account #1 : Sign-up backend account
Account #2 : Marketplace backend account
Account #3 : Not used
Account #4 : Not used
Account #5 : Not used
Account #6 : Not used
Account #7 : Not used
Account #8 : Not used
Account #9 : Not used
Account #10: Not used
To see the accounts details, check the docker logs:
docker logs docker_starknet-devnet_1
Follow the instructions on onlydustxyz/starknet-accounts
repository and provide the marketplace-backend
account public key as input and re-run the same process for the signup
account.
Add some ETH in them to be able to send transactions later:
curl -H "Content-Type: application/json" -X POST --data '{"address":"0x061e0474b7cdbfaf15e54e97c2bb632d365ccf553320a7db511c07950250948e", "amount":100000000000000000000}' "http://127.0.0.1:5050/mint"
curl -H "Content-Type: application/json" -X POST --data '{"address":"0x0488cbf60f5d972aeee11bb8bcce7cecb8023f7a7cc5f2c7f6d9f53c8f68ff17", "amount":100000000000000000000}' "http://127.0.0.1:5050/mint"
Check the account balance with the following command:
curl -H "Content-Type: application/json" -X GET "http://127.0.0.1:5050/account_balance?address=0x061e0474b7cdbfaf15e54e97c2bb632d365ccf553320a7db511c07950250948e"
curl -H "Content-Type: application/json" -X GET "http://127.0.0.1:5050/account_balance?address=0x0488cbf60f5d972aeee11bb8bcce7cecb8023f7a7cc5f2c7f6d9f53c8f68ff17"
Update the ACCOUNT_ADDRESS
environment variable in .env.example
file for both repositories.
Update the .env.local
file in marketplace-starknet
repository.
First, remove the local cache file:
[ -f build/deployed_contracts_local.txt ] && rm build/deployed_contracts_local.txt
Then, follow the instructions in Deploy
section
Once contracts are deployed, update the .env.example
file of both repositories with the correct smart contracts addresses.
curl -X POST http://localhost:5050/dump -d '{ "path": "/tmp/dump.pkl" }' -H "Content-Type: application/json"
and wait for the dump file to be complete:
watch du $MARKETPLACE_BACKEND_ROOT/scripts/docker/dev/dump.pkl
🎉 Congratulations, the dump file is ready!
docker-compose down
Pull requests are welcome, please check our contribution guidelines.
deathnote-contributions-starknet is released under the MIT.
- supprimer le CONTRIBUTION_CLASS_HASH du fichier deployed_contracts_prod.txt
- verifier que contributions.cairo importe bien les nouvelles fonctions de migration
- verifier qu'il n'y a PAS de script de migration (contributions_migration.cairo)
- executer le script de deploiement afin de MAJ l'implem du proxy de contributions
- tester une migration qui revert