Smart Contracts
DO NOT SEND YOUR TOKENS TO ANY OF THE BELOW CONTRACTS
H4SHFund Contracts
Factory
0x...
Treasury
0x...
Smart Contracts
The Core Smart contracts are as follows
Factory:
The factory is responsible for deploying EIP-1167 compatible clones for LaunchEvents.
It handles the protocol fee and early withdrawl fees which can be set by an owner.
The Fee Receiver is the nominated address where protocol fees will be directed too.
Leap Contract Documentation
The Leap contract is a next-generation campaign and fundraising manager that enables decentralized fundraising campaigns with automated liquidity provisioning, token vesting, and treasury management capabilities.
Key Features
Decentralized fundraising campaigns
Automated liquidity provisioning on Uniswap V3
Token vesting via Sablier streams
Treasury management for DAOs
Contract Overview
The Leap contract inherits from LeapBase
and implements ReentrancyGuard
to provide secure fundraising functionality.
Constructor Parameters
_positionManager
: Address of the Uniswap V3 position manager_wNative
: Address of the wrapped native token_uniswapV3Factory
: Address of the Uniswap V3 factory_lockupLinear
: Address of the Sablier lockup linear contract_leapFactory
: Address of the LeapFactory contract
Core Functions
depositNative()
Allows users to deposit native tokens into the launch event during the deposit phase.
Requirements:
Must be in
PHASE_DEPOSIT
If whitelist is enabled, sender must be whitelisted
Deposit amount must be within min/max allocation limits
Cannot exceed maximum raise amount (if set)
withdrawNative(uint256 amountToRemove)
Enables users to withdraw their native tokens during deposit or phase one.
Parameters:
amountToRemove
: Amount of native tokens to withdraw
Features:
Available during
PHASE_DEPOSIT
andPHASE_ONE
Incurs a withdrawal fee during
PHASE_ONE
Burns corresponding receipt tokens
createTokenSetupLiquidityAndVesting(bytes32 tokenSalt, int24 tickLower, int24 tickUpper)
Finalizes the campaign by setting up the token, liquidity pool, and vesting stream.
Parameters:
tokenSalt
: Salt for token creationtickLower
: Lower tick for Uniswap V3 positiontickUpper
: Upper tick for Uniswap V3 position
Actions:
Creates the launch token
Calculates and distributes protocol fees
Sets up Uniswap V3 liquidity pool (if LP percentage > 0)
Creates Sablier vesting stream (if tokens remain for vesting)
Distributes remaining funds to DAO treasury
Requirements:
Can only be called by owner
Must be in
PHASE_THREE
orDEPLETED
Total raised amount must be greater than 0
Events
NativeDeposited(address indexed user, uint256 amount)
NativeWithdrawn(address indexed user, uint256 amount, uint256 fee)
CampaignFinalized(uint256 streamId, uint256 protocolFeeAmount)
Security Features
ReentrancyGuard implementation
Phase-based access control
Whitelist support
Comprehensive input validation
Fee management system
Dependencies
The contract integrates with several external protocols and libraries:
Uniswap V3 for liquidity provisioning
Sablier V2 for token vesting
OpenZeppelin for security features
Custom libraries for math operations and error handling
LeapBase Contract Documentation
The LeapBase contract serves as the foundational abstract contract for all LEAP events, providing core functionality for launch events, Sablier streams, and Uniswap V3 pool management.
Core Components
Constants
PRECISION
: 1e18 (used for percentage calculations)MAX_TOKEN_SUPPLY
: 1 billion tokens (with 18 decimals)FEE_TIER
: 10,000 (1% fee tier for Uniswap V3)
Immutable Variables
LOCKUP_LINEAR
: Sablier V2 lockup linear contract interfaceUNISWAP_V3_FACTORY
: Uniswap V3 factory interfaceWNATIVE
: Wrapped native token addressPOSITION_MANAGER
: Uniswap V3 position manager addressLEAP_FACTORY
: LEAP factory contract address
Storage Variables
launchToken
: Token details (address, name, symbol)phaseTimeStamps
: Timestamps for different launch phaseslaunchParams
: Launch parameters (treasury, token supply, etc.)totalRaised
: Total native tokens raiseduniswapV3PoolCreated
: Address of created Uniswap V3 pooluniswapLPTokenId
: ID of Uniswap V3 LP positionstreamId
: Sablier stream IDaccTokenPerShare
: Accumulated tokens per shareusersRewardDebt
: User reward debt mapping
Key Functions
Initialization
Initializes the contract with launch parameters. Can only be called once.
Liquidity Management
Initialize Pool and Mint Liquidity
Creates and initializes a Uniswap V3 pool with initial liquidity.
Remove LP
Removes LP position after lock period and transfers to DAO treasury.
Claim LP Fees
Claims accumulated fees from LP position to DAO treasury.
Sablier Stream Management
Create Vesting Stream
Creates a Sablier vesting stream for token distribution.
Redeem Streamed Amount
Allows users to claim their vested tokens based on receipt token balance.
Token Management
Creates the launch token and distributes initial supply.
Phase Management
Returns the current phase of the launch event:
NOT_STARTED
PHASE_DEPOSIT
PHASE_ONE
PHASE_TWO
PHASE_THREE
DEPLETED
Whitelist Management
Manages whitelisted addresses for participation.
Receipt Token Functionality
The contract includes modified ERC20 functionality for receipt tokens:
Transfers restricted to zero address or contract address
Custom name ("RX Token") and symbol ("RX")
Non-transferable design to maintain vesting mechanics
Events
TokenCreated
: Emitted when launch token is createdUniswapV3PoolCreated
: Emitted when Uniswap pool is createdLPTransferred
: Emitted when LP position is transferredLPFeesClaimed
: Emitted when LP fees are claimedAddWhitelist
: Emitted when address added to whitelistRemoveWhitelist
: Emitted when address removed from whitelist
Security Features
Ownership controls via OpenZeppelin's
Ownable
Phase-based access control
Non-transferable receipt tokens
Comprehensive parameter validation
Safe ERC20 operations
Integration Points
Uniswap V3 for liquidity management
Sablier V2 for token vesting
OpenZeppelin for security and token standards
Custom error handling via
Errors
library
LeapDaoManager Contract Documentation
The LeapDaoManager contract serves as the treasury management system for LEAP events, providing basic but secure functionality for DAO treasury control. This is version 0.0.1, designed as the foundational implementation with room for future upgrades.
Core Features
Multi-manager style management (up to 5 managers)
Generic execution capability for treasury management
Native token receiving capability
Manager addition and removal functionality
Storage
Manager Storage
Array storing all DAO manager addresses (maximum 5 managers)
Key Functions
Constructor
Initializes the contract with the first DAO manager.
Parameters:
initialOwner
: Address of the initial DAO manager
Manager Management
Add Manager
Adds a new DAO manager to the system.
Requirements:
Caller must be an existing manager
New manager must not already be a manager
Cannot exceed 5 total managers
Emits
ManagerAdded
event
Remove Manager
Removes an existing DAO manager from the system.
Requirements:
Caller must be an existing manager
Cannot remove yourself
Cannot remove last manager
Emits
ManagerRemoved
event
View Functions
Returns array of all current DAO managers.
Checks if an address is a current DAO manager.
Treasury Management
Execute
Allows managers to execute arbitrary transactions for treasury management.
Parameters:
contracts
: Array of target contract addressesdata
: Array of calldata for each contract interactionmsgValues
: Array of native token amounts to send with each call
Requirements:
Caller must be a DAO manager
All array lengths must match
Each call must succeed
Events
ManagerAdded
Emitted when a new manager is added.
Parameters:
addedBy
: Address of the manager who added the new managermanager
: Address of the newly added manager
ManagerRemoved
Emitted when a manager is removed.
Parameters:
removedBy
: Address of the manager who removed the managermanager
: Address of the removed manager
Security Features
Manager-only access control via
onlyDaoManager
modifierMaximum of 5 managers to prevent coordination issues
Cannot remove last manager to ensure continued control
Cannot remove self to prevent accidental lockouts
Safe ERC20 operations using OpenZeppelin's SafeERC20
Native Token Handling
The contract can receive native tokens through:
Limitations and Future Improvements
Basic implementation with room for upgrades
No time-locks on manager changes
No voting mechanism for manager decisions
No quorum requirements for execution
No transaction queuing system
Integration Points
OpenZeppelin's SafeERC20 for token operations
Custom error handling via
Errors
libraryCompatible with any ERC20 token and native currency
Last updated