mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
Sonr Smart Contracts
This directory contains the smart contracts for the Sonr blockchain, including the WSNR (Wrapped SNR) ERC-20 token contract.
Setup
Prerequisites
- Install Foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryup
- Install dependencies:
make install
- Copy environment variables:
cp .env.example .env
- Configure your
.envfile with appropriate values
Development
Build contracts:
make build
Run tests:
make test
Run tests with gas reporting:
make test-gas
Generate coverage report:
make coverage
Format code:
make format
Deploy to local Sonr network:
make deploy-local
Deploy to Sonr testnet:
make deploy-testnet
Clean build artifacts:
make clean
Start local Anvil node (for testing):
make anvil
Project Structure
contracts/
├── src/ # Contract source files
├── test/ # Test files
├── script/ # Deployment scripts
├── lib/ # Dependencies (gitignored)
├── foundry.toml # Foundry configuration
└── Makefile # Build commands
Testing on Sonr Native EVM
Start the local testnet with EVM enabled:
# From project root
docker-compose -f docker-compose.dev.yml up -d sonr-node
The EVM JSON-RPC endpoint will be available at:
- HTTP: http://localhost:8545
- WebSocket: ws://localhost:8546
Foundry Commands
For a full list of available commands:
make help
Contract Addresses
- WSNR: TBD (after deployment)