Smart contract project for on-chain interaction functionalities of Permacast.
Decentralized curator registry contract for recording users who activate their curator identity.
Main Functions:
activateCurator()- Activate curator identity (each address can be activated only once)checkCurator(address)- Check whether an address is a curatorgetTotalCurators()- Get the total number of curatorsgetCurators(offset, limit)- Get curator list with pagination
Content interaction contract for recording on-chain content boosts by users.
Main Functions:
boostContent(contentId, contentType)- Boost contentcancelBoost(contentId)- Cancel content boostcheckInteraction(user, contentId)- Check boost statusgetUserInteractionCount(user)- Get the number of user interactionsgetContentBoostCount(contentId)- Get the number of content boostsgetContentBoosters(contentId)- Get the list of users who boosted the content
pnpm installpnpm compile# Run all tests
pnpm test
# Run tests and show gas consumption
pnpm test:gasCopy .env.example to .env and fill in the required fields:
cp .env.example .envEdit the .env file:
# Private key (used for contract deployment, do NOT include the 0x prefix)
PRIVATE_KEY=your_private_key_here
# BSC Mainnet RPC
BSC_RPC_URL=https://bsc-dataseed1.binance.org
# BSC Testnet RPC
BSC_TESTNET_RPC_URL=https://data-seed-prebsc-1-s1.binance.org:8545
# Whether to use testnet (true for testnet, false for mainnet)
USE_BSC_TESTNET=true
# BSCScan API Key (for contract verification)
BSCSCAN_API_KEY=your_bscscan_api_key_here
# Contract addresses (fill in after deployment)
CURATOR_REGISTRY_ADDRESS=
CONTENT_INTERACTION_ADDRESS=Important Notes:
- Set
USE_BSC_TESTNET=truefor development and testing - Set
USE_BSC_TESTNET=falsefor production - Remember to fill in the contract addresses in
.envafter deployment
# Start local node
pnpm node
# Deploy in another terminal
pnpm deploy:localpnpm deploy:testnetpnpm deploy:mainnetThe deployment script will automatically:
-
Save deployment info to a JSON file
- Path:
deployments/{network}-{chainId}.json - Content: network info, deployer address, contract addresses, transaction hash, timestamp
- Path:
-
Auto-update the .env file
- Auto-add/update
CURATOR_REGISTRY_ADDRESS - Auto-add/update
CONTENT_INTERACTION_ADDRESS
- Auto-add/update
-
Deployment Info Example
{ "network": "hardhat", "chainId": "31337", "deployer": "0x...", "timestamp": "2026-02-13T10:37:04.852Z", "contracts": { "CuratorRegistry": { "address": "0x...", "transactionHash": "0x..." }, "ContentInteraction": { "address": "0x...", "transactionHash": "0x..." } } }
You can verify contracts on BSCScan after deployment:
# Testnet
pnpm verify:testnet <CONTRACT_ADDRESS>
# Mainnet
pnpm verify:mainnet <CONTRACT_ADDRESS>- Hardhat Local: Chain ID 31337
- BSC Testnet: Chain ID 97
- BSC Mainnet: Chain ID 56
Deployed contract addresses will be saved in deployment logs. Please keep them properly.
- Private Key Security: Never commit private keys to version control systems
- Sufficient Testing: Fully test on Testnet before deploying to Mainnet
- Gas Optimization: Contracts have been gas-optimized, but actual consumption should still be monitored
- Audit Recommendation: A security audit is recommended before Mainnet deployment
MIT