Cloud Documentation
Cloud launches on SushiSwap Launchpad on Robinhood Chain (4663). Technical reference for the HolderRewardHook, FeeDistributor, and automatic reward distribution.
Architecture
Cloud launches on SushiSwap Launchpad on Robinhood Chain (4663). Rewards are powered by the FeeDistributor contract:
Reward Pool → FeeDistributor → distributeAll() → Holders (daily)
WETH is deposited into the FeeDistributor periodically. Every 24 hours, it auto-distributes to all CLOUD holders proportionally.
Contracts
| Contract | Purpose | Key Functions |
|---|---|---|
| CLOUD Token | ERC-20 token launched on SushiSwap Launchpad | Standard ERC-20 |
| FeeDistributor | Receives WETH and auto-distributes to holders daily | distributeAll, earned, notifyReward |
Deployed on Robinhood: Distributor at 0x4904...B4f5
Deployment
# 1. Set environment variables export PRIVATE_KEY=0x... export POOL_MANAGER=0x... # Robinhood V4 PoolManager export REWARD_TOKEN=*** # Your CLOUD token export FEE_TOKEN=*** # WETH on Robinhood export FEE_BPS=100 # 1% # 2. Deploy forge script script/DeployFactory.sol then DeployHook.sol --rpc-url $ROBINHOOD_RPC_URL --broadcast
HolderRewardHook
Intercepts swaps and collects fees via afterSwap + afterSwapReturnDelta.
Constructor
constructor( address _owner, // Contract owner IPoolManager _poolManager, // V4 PoolManager uint24 _feeBps, // Fee (100 = 1%) address _feeDistributor, // FeeDistributor contract Currency _feeCurrency // Currency to collect )
Write Functions
| Function | Access | Description |
|---|---|---|
setFeeBps(uint24) | Owner | Change fee (max 2500 = 25%) |
setFeeDistributor(address) | Owner | Change fee recipient |
FeeDistributor
Receives fees and lets token holders claim their share using a reward-per-token accumulator.
Constructor
constructor(address _owner, address _rewardToken, address _feeToken)
Functions
| Function | Access | Returns | Description |
|---|---|---|---|
earned(address) | Public view | uint256 | Check claimable rewards |
claim() | Public | — | Claim your rewards |
claimFor(address[]) | Public | — | Claim for multiple (gas saver) |
notifyReward() | Public | — | Update accumulator with new balance |
setRewardToken(address) | Owner | — | Change reward token |
Hook Permissions
4 of 14 flags enabled:
getHookPermissions() → { beforeAddLiquidity: true // Owner-only LP beforeRemoveLiquidity: true // Owner-only LP afterSwap: true // Fee collection afterSwapReturnDelta: true // Return fee delta // ALL OTHER FLAGS: false }
Formulas
Fee Per Swap
feeAmount = outputAmount × feeBps / 10000
Reward Per Token
rewardPerTokenStored += (newRewards × 1e18) / totalSupply
Holder Earned
earned(account) = (balanceOf(account) × (rewardPerTokenStored - userRewardPerTokenPaid[account])) / 1e18 + rewards[account]
Creating a Pool
// 1. Define the pool key PoolKey memory key = PoolKey({ currency0: Currency.wrap(WETH_ADDRESS), currency1: Currency.wrap(CLOUD_ADDRESS), fee: 3000, // 0.3% LP fee tickSpacing: 60, hooks: holderRewardHook // YOUR hook }); // 2. Initialize poolManager.initialize(key, sqrtPriceX96); // 3. Add liquidity (LP NFT goes to YOUR wallet) posm.mint(...);
Important: The hook address is immutable after pool creation. It encodes permissions via the low 14 bits.
Holder Guide
- Hold CLOUD tokens in your wallet
- Wait: rewards arrive automatically every 24 hours
- That's it. WETH appears in your wallet. No claiming needed.
No staking. No lockup. No website. Just hold and earn.
How Distribution Works
| Step | Action | Who |
|---|---|---|
| 1. Fees accumulate | Every swap sends 1% to FeeDistributor | Automatic (hook) |
| 2. Every 24 hours | Cron calls distributeAll() to push rewards | Automatic (keeper) |
| 3. WETH arrives | Proportional WETH lands in your wallet | Holder |
Automatic: Rewards are pushed to you every 24 hours. No gas costs for holders. No website needed. Just hold CLOUD.
How Your Share Is Calculated
yourShare = (yourBalance / totalSupply) × totalFeesCollected
Hold 1% of all CLOUD = earn 1% of all fees. Balance checked at claim time.