Before you begin, ensure you have the following tools installed:
- Node (>= v18.17)
- Yarn (v1 or v2+)
- Git
To ensure the proper functioning of openmark contracts, your local Scarb
version must be 2.5.4
. First, check your local Scarb version:
scarb --version
If your local Scarb version is not 2.5.4
, you need to install it.
-
Add the Scarb plugin:
asdf plugin add scarb
-
Install the specific version (e.g., 2.5.4):
asdf install scarb 2.5.4
-
Set the global version:
asdf global scarb 2.5.4
Alternatively, you can install Scarb using the following command:
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.5.4
To ensure the proper functioning of the tests on openmark contracts, your Starknet Foundry version must be 0.25.0. First, check your Starknet Foundry version:
snforge --version
If your Starknet Foundry version is not 0.25.0
, you need to install it.
- Scarb - v2.5.4
- Snforge - v0.23
- Cairo - v2.5.4
- Rpc - v0.5.1
-
Clone this repository and install dependencies:
git clone https://github.com/grindytech/openmark-cairo-contract --recurse-submodules cd openmark-cairo-contract yarn install
-
Run a local network in the first terminal:
Note: You can skip this step if you want to use Sepolia Testnet.
yarn chain
This command starts a local Starknet network using Devnet. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in
scaffold.config.ts
for your Next.js app.Note: If you are on Sepolia or mainnet, for a better user experience on your app, you can get a dedicated RPC from Infura dashboard. A default is provided here. To use this, run:
cp packages/nextjs/.env.example packages/nextjs/.env.local
-
On a second terminal, deploy the sample contract:
yarn deploy --network {NETWORK_NAME} // when NETWORK_NAME is not specified, it defaults to "devnet"
Note: To use Sepolia testnet, set
{NETWORK_NAME}
tosepolia
.This command deploys a sample smart contract to the local network. The contract is located in
packages/snfoundry/contracts/src
and can be modified to suit your needs. Theyarn deploy
command uses the deploy script located inpackages/snfoundry/scripts-ts/deploy.ts
to deploy the contract to the network. You can also customize the deploy script. -
On a third terminal, start your Next.js app:
yarn start
Visit your app at:
http://localhost:3000
. You can interact with your smart contract using theDebug Contracts
page. You can tweak the app config inpackages/nextjs/scaffold.config.ts
.
This project is forked from Scaffold-Stark. We extend our gratitude to them for their excellent work and contributions to the community.
Visit Scaffold Docs to learn how to start building with Scaffold.