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

ContractPurposeKey Functions
CLOUD TokenERC-20 token launched on SushiSwap LaunchpadStandard ERC-20
FeeDistributorReceives WETH and auto-distributes to holders dailydistributeAll, 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

FunctionAccessDescription
setFeeBps(uint24)OwnerChange fee (max 2500 = 25%)
setFeeDistributor(address)OwnerChange 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

FunctionAccessReturnsDescription
earned(address)Public viewuint256Check 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

  1. Hold CLOUD tokens in your wallet
  2. Wait: rewards arrive automatically every 24 hours
  3. That's it. WETH appears in your wallet. No claiming needed.

No staking. No lockup. No website. Just hold and earn.

How Distribution Works

StepActionWho
1. Fees accumulateEvery swap sends 1% to FeeDistributorAutomatic (hook)
2. Every 24 hoursCron calls distributeAll() to push rewardsAutomatic (keeper)
3. WETH arrivesProportional WETH lands in your walletHolder
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.