EdenCore Contract
The EdenCore contract is the main orchestrator for the EdenVest protocol. It routes deposits, performs token swaps to cNGN, mints LP tokens and NFT positions, handles withdrawals (with optional swap on exit), and coordinates pool lifecycle via the factory.Related Contracts
Assetchain Mainnet
| Contract | Address |
|---|---|
| EdenCore Proxy | 0xA5f9e65B17ed0B34263285a5bE9059E45Fd61597 |
| EdenAdmin | 0xa4EbDFC4949Ba52E837Fca3b6a2fAb98c7492b5C |
| TaxCollector | 0x5104b1E5fDBa07a4DE396b70Ff19Da5a58b6A2d1 |
| SwapRouter | 0x0A46C99cA1e64aB05A943907FC6361476899Dd1c |
| PoolFactory | 0xd8D7338FB2f854c1F40F55Ef28dC2134FA3141f1 |
| NFTPositionManager | 0xD200b9D79570beb26F105eBe6ce5D5FE6a9BDC83 |
Assetchain Enugu Testnet
| Contract | Address |
|---|---|
| EdenCore Proxy | 0xC2EdCE6C2282B367A1269Ff77FB95855067cdaaf |
| EdenAdmin | 0xE15e1aED46cE2D8A319E4885CE52177D0696722D |
| TaxCollector | 0x3BAb3110A2C4D986320F83Ac86Bab1229B3e7e4C |
| SwapRouter | 0x87A09E8048E06765A21742399018d684f2E690b3 |
| PoolFactory | 0x4f703B2A060859a38DEFc9c34C8Ab02df160b15E |
| NFTPositionManager | 0x1824De8E500F92E5C08de4a152e74224548Daa83 |
What EdenCore Does
Process Investments
Accepts direct cNGN or performs swap-then-invest in one transaction
Mint Receipts
Issues LP tokens (ERC‑20) and non-transferable NFT positions (ERC‑721)
Handle Withdrawals
Redeem to cNGN or swap to chosen token on exit
Manage Pools
Create and toggle pool activation through the factory
Key Features
Architecture Flow
Key Data Structures
InvestmentParams
Used for swap-and-invest operations:WithdrawAndSwapParams
Used for withdraw-and-swap operations:Core Functions
Investment Functions
invest()
Direct investment using cNGN tokens without swapping.
pool: Target investment pool addressamount: Investment amount in cNGNtitle: Custom title for the investmentdeadline: Transaction deadline (0 for no deadline)
- Validates pool registration and active status
- Transfers cNGN from user and approves pool
- Calls
InvestmentPool.invest()to mint LP and NFT - Collects protocol tax in LP tokens to TaxCollector
- Emits
InvestmentMadeevent
tokenId: NFT position token IDlpTokens: LP tokens minted to investor
investWithSwap()
Invest using any ERC‑20 token. EdenCore swaps to cNGN then invests in one transaction.
- Slippage Protection: Applies default 1% slippage protection
- Liquidity Validation: Checks available swap liquidity
- Balance Verification: Ensures swap executed correctly
Withdrawal Functions
withdraw()
Withdraw matured positions to receive cNGN directly, by burning LP tokens and NFT.
- Validates investment maturity and ownership
- Burns LP tokens and NFT position
- Transfers principal + returns to investor
withdrawAndSwap() - Withdraw with Token Swap
Withdraw to cNGN then optionally swap to another token in a single transaction.
- Validates pool and transfers LP tokens
- Withdraws to cNGN via
InvestmentPool.withdraw() - If
tokenOut == cNGN: sends cNGN directly to user - Otherwise: swaps cNGN to
tokenOutwith slippage protection
Pool Management Functions
createPool()
Create new investment pools (Admin only).
View Functions
getAllPools() / getActivePools()
Retrieve pool information.
checkSwapLiquidity()
Check available liquidity for token swaps.
Access Control
The contract implements OpenZeppelin’sAccessControl with these roles:
| Role | Purpose | Functions |
|---|---|---|
DEFAULT_ADMIN_ROLE | Super admin | All admin functions |
ADMIN_ROLE | Protocol admin | Configuration updates |
POOL_CREATOR_ROLE | Pool creator | Create pools |
EMERGENCY_ROLE | Emergency controls | Pause/emergency functions |
Events
Investment Events
Administrative Events
Error Handling
The contract includes comprehensive error checking:Integration Examples
React Frontend Integration
Pool Creation Example
Security Considerations
Input Validation
- All amounts must be greater than zero
- Pool addresses must be registered and active
- Deadlines must be in the future
- Token addresses must be valid contracts
Slippage Protection
- Automatic slippage calculation for swaps
- Configurable maximum slippage limits
- Real-time liquidity checks
Access Controls
- Role-based function access
- Multisig requirements for critical operations
- Emergency pause capabilities
Upgrade Mechanism
EdenCore uses the UUPS (Universal Upgradeable Proxy Standard) pattern:- Proxy Contract: Handles storage and delegatecalls
- Implementation Contract: Contains business logic
- Admin Controls: Only
ADMIN_ROLEcan authorize upgrades

