This repository contains the Cairo smart contract implementation for the Garden Finance project. It enables Hashed Time-Locked Contract (HTLC) functionality on Starknet, facilitating secure cross-chain transactions.
Ensure you have the following dependencies installed:
- Node.js (v16 or higher)
- Yarn (package manager)
- Starknet Devnet (for local testing)
- Hardhat (for Ethereum testing)
- Cairo - Cairo setup guide
Follow these steps to set up your development environment:
Run the following command to install required packages:
yarn install
Use Scarb to compile the Cairo smart contract:
scarb build
Run merry to start a Multichain local environment for testing:
merry go
Execute the test suite to ensure everything is working correctly:
yarn test
- Node.js and Yarn installed
.env
file with the following variables: DEPLOYER_PRIVATE_KEY=your_private_key DEPLOYER_ADDRESS=your_account_address
Run the following command to install required packages:
yarn install
scarb build
Launch a local Starknet development environment:
# Sepolia Testnet
yarn deploy sepolia "https://starknet-sepolia.public.blastapi.io" <token_address>
# Mainnet
yarn deploy mainnet "https://your-mainnet-rpc" <token_address>
# Local Devnet
yarn deploy devnet "http://127.0.0.1:5050" <token_address>
# Example
yarn deploy sepolia "https://starknet-sepolia.public.blastapi.io" 0x4718F5A0FC34CC1AF16A1CDEE98FFB20C31F5CD61D6AB07201858F4287C938D
After successful deployment, a JSON file named ._<contract_address>.json will be created in the project root directory containing all deployment details including contract address, transaction hash, and network information.