Smart contracts for yield farming on Push Chain (PC) token ecosystem.
Three staking contracts for different yield farming scenarios:
- MigrationYieldFarm - Epoch-based staking with migration incentives
- RewardSeasonsYieldFarm - Seasonal staking with snapshot-based rewards
- LPYield/UniswapV3Staker - LP position staking for Uniswap V3
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup
# Install Node.js dependencies for Merkle tree generation
npm install
# Install Foundry dependencies
forge install
# Build all contracts
forge build
# Run all tests
forge test
- Lock period: 90 days (3 months)
- Epoch duration: 21 days
- Cooldown: 1 epoch (21 days)
- Features: Merkle whitelist, epoch-based rewards, migration tracking, upgradeable
- Season duration: 90 days (3 months)
- Lock period: Full season (no early unstaking)
- Cooldown: 7 days (configurable)
- Features: Merkle whitelist with multipliers, season-end snapshot, combined harvest+unstake
- Incentive duration: Up to 90 days
- Features: Real-time rewards, time-weighted distribution, multiple incentives, direct LP staking
# Update script/DeployMigrationYieldFarm.s.sol with:
# - merkleRoot: Whitelist merkle root
# - owner_: Admin address
# - lockDays: Lock period (default: 90)
# - cooldownEpochs: Cooldown in epochs (default: 1)
# - rewardsDays: Epoch duration (default: 21)
forge script script/DeployMigrationYieldFarm.s.sol \
--rpc-url <your-rpc-url> \
--private-key <your-private-key> \
--broadcast
# Update script/DeployRewardSeasonsYieldFarm.s.sol with:
# - merkleRoot: Whitelist merkle root
# - owner_: Admin address
# - lockPeriod: Season duration (default: 90 days)
# - cooldownPeriod: Cooldown period (default: 7 days)
forge script script/DeployRewardSeasonsYieldFarm.s.sol \
--rpc-url <your-rpc-url> \
--private-key <your-private-key> \
--broadcast
# Update script/DeployLPYield.s.sol with:
# - factory: Push Chain Uniswap V3 Factory address
# - positionManager: Push Chain Position Manager address
# - maxIncentiveStartLeadTime: Max advance notice (default: 30 days)
# - maxIncentiveDuration: Max incentive duration (default: 90 days)
forge script script/DeployLPYield.s.sol \
--rpc-url <your-rpc-url> \
--private-key <your-private-key> \
--broadcast
forge test
forge test -v
forge test --gas-report
# MigrationYieldFarm
forge test --match-contract MigrationYieldFarmTest
# RewardSeasonsYieldFarm
forge test --match-contract RewardSeasonsYieldFarmTest
# LPYield/UniswapV3Staker
forge test --match-contract UniswapV3StakerForkTest
forge test --match-test test_Stake_NewUser
forge test --match-test test_CompleteRealLifecycleStaking
forge test --match-test test_ReentrancyProtection_Complete
# Pattern matching
forge test --match-test "test_Stake*"
forge test --match-test "*Security*"
LPYield tests use real Push Chain testnet fork and take longer due to network interaction.
cd scripts
node generate-merkle.js
cd scripts
node generate-reward-merkle.js
Edit the claims
array in the respective script files:
const claims = [
{
address: "0x...", // User address
amount: "1000000000000000000", // Stake amount (wei)
epoch: 1 // Migration epoch
}
// Add more users...
];
forge build
forge build --contracts src/MigrationYieldFarm.sol
forge build --use solc:0.8.23
forge lint
forge fmt
forge inspect --pretty
forge test --match-contract RewardSeasonsYieldFarmTest --gas-report
forge snapshot
- Update merkle root in deployment scripts
- Set correct owner address
- Verify RPC endpoint and network
- Test deployment on testnet first
- Verify contract addresses on explorer
- Test all admin functions
- Verify merkle proof verification
- Verify contract initialization
- Test staking with valid merkle proofs
- Test reward distribution
- Test admin functions
- Monitor for any issues
- Document deployed addresses
├── src/
│ ├── MigrationYieldFarm.sol # Epoch-based staking
│ ├── RewardSeasonsYieldFarm.sol # Seasonal staking
│ └── LPYield/
│ ├── UniswapV3Staker.sol # LP position staking
│ ├── interfaces/ # Contract interfaces
│ └── libraries/ # Utility libraries
├── script/
│ ├── DeployMigrationYieldFarm.s.sol # Migration deployment
│ ├── DeployRewardSeasonsYieldFarm.s.sol # Seasonal deployment
│ └── DeployLPYield.s.sol # LP staking deployment
├── test/
│ ├── MigrationYieldFarm.t.sol # Migration tests
│ ├── RewardSeasonsYieldFarm.t.sol # Seasonal tests
│ └── UniswapV3StakerFork.t.sol # LP staking tests
├── scripts/
│ ├── generate-merkle.js # Migration whitelist
│ └── generate-reward-merkle.js # Seasonal whitelist
└── foundry.toml # Foundry configuration