/carbon-protocol

Carbon Starknet Protocol written in Cairo.

Primary LanguageCairoApache License 2.0Apache-2.0

Carbon Protocol on Starknet

Carbonable contracts written in Cairo for StarkNet.

Usage

⚠️ WARNING! ⚠️

This repo contains highly experimental code. Expect rapid iteration. Use at your own risk.

Set up the project

📦 Install the requirements

🎉 Install

protostar install

⛏️ Compile

protostar build

🌡️ Test

# Run all tests
protostar test

# Run only unit tests
protostar test tests/units

# Run only integration tests
protostar test tests/integrations

🌐 Test account

If you want a fresh account for tests, you can deploy an account with the following command:

starknet deploy_account --network=<network>

It will generate the account information into the ~/.starknet_accounts/starknet_open_zeppelin_accounts.json file.
See also starknet documentation for more details.

💋 Format code

cairo-format -i src/**/*.cairo tests/**/**/*.cairo

📝 Documentation

Requirements

Generation

cd docs
kaaper generate ../src ./data
python build.py
callgraphs.sh

🚀 Deployment

See How to deploy Carbonable Protocol

Inputs

To manage inputs sent to constructor during the deployment, you can customize the config files.

Prepare the contracts before tests

After deployment, the admin account (according to parameters) is the owner of all contracts. So far, you have to do the following actions manually:

  • Change the NFT contract owner from admin to Minter contract
    • How: Voyager > Write contract > transferOwnership
    • Verify: Voyager > Read contract > owner
  • Approve the Minter contract to spend the admin payment tokens
    • How: Voyager > Write contract > approve
    • Verify: Voyager > Read contract > allowance
  • Buy NFT through the Minter contract
    • How: Voyager > Write contract > buy
    • Verify: Voyager > Read contract > balanceOf (of the NFT contract)

📄 License

carbon-protocol is released under the MIT.