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
# Sepolia Testnet
yarn deploy:htlc sepolia "https://starknet-sepolia.public.blastapi.io" <token_address>
# Mainnet
yarn deploy:htlc mainnet "https://your-mainnet-rpc" <token_address>
# Local Devnet
yarn deploy:htlc devnet "http://127.0.0.1:5050" <token_address>
# Example
yarn deploy:htlc sepolia "https://starknet-sepolia.public.blastapi.io" 0x4718F5A0FC34CC1AF16A1CDEE98FFB20C31F5CD61D6AB07201858F4287C938D
# Sepolia Testnet
yarn deploy:multicall sepolia "https://starknet-sepolia.public.blastapi.io"
# Mainnet
yarn deploy:multicall mainnet "https://your-mainnet-rpc"
# Local Devnet
yarn deploy:multicall devnet "http://127.0.0.1:5050"
# Example
yarn deploy:multicall sepolia "https://starknet-sepolia.public.blastapi.io/rpc/0_8"
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.