Skip to content

oikos-cash/core

Repository files navigation

Oikos Protocol

Next-gen DeFi launchpad

Website | Documentation | Twitter | Discord

Solidity License Foundry BSC


Overview

Oikos Protocol is a next-generation DeFi infrastructure that combines autonomous liquidity management, collateralized lending, and adaptive token supply mechanisms built on Uniswap V3. The protocol enables permissionless token launches with built-in liquidity, staking rewards, and borrowing capabilities.

Key Features

  • Diamond Architecture (EIP-2535) - Modular, upgradeable smart contract system
  • Autonomous Liquidity Management - Protocol-owned liquidity on Uniswap V3
  • Collateralized Lending - Borrow against protocol liquidity with dynamic rates
  • Adaptive Supply Controller - Algorithmic supply adjustments based on market conditions
  • Staking & Rebasing - Stake OKS tokens for sOKS with auto-compounding rewards
  • MEV Protection - TWAP oracle integration for manipulation-resistant pricing
  • Presale Infrastructure - Fair launch mechanism with soft/hard caps and referral system

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                         OikosFactory                                 │
│  (Vault Deployment, Token Creation, Protocol Configuration)          │
└─────────────────────────────────────────────────────────────────────┘
                                   │
          ┌────────────────────────┼────────────────────────┐
          │                        │                        │
          ▼                        ▼                        ▼
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│  TokenFactory   │    │   ExtFactory    │    │ DeployerFactory │
│  (OKS Token)    │    │ (Vault Facets)  │    │  (Deployers)    │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                                   │
                                   ▼
┌─────────────────────────────────────────────────────────────────────┐
│                        Diamond Vault (EIP-2535)                      │
├─────────────────┬─────────────────┬─────────────────┬───────────────┤
│   BaseVault     │  LendingVault   │  StakingVault   │   AuxVault    │
│   (Core Logic)  │  (Borrowing)    │  (Rewards)      │   (Helpers)   │
├─────────────────┼─────────────────┼─────────────────┼───────────────┤
│ ExtVaultShift   │ ExtVaultLending │ExtVaultLiquidat.│  LendingOps   │
│ (Price Shifts)  │  (Loan Mgmt)    │ (Liquidations)  │  (Operations) │
└─────────────────┴─────────────────┴─────────────────┴───────────────┘
                                   │
                                   ▼
┌─────────────────────────────────────────────────────────────────────┐
│                        Uniswap V3 Pool                               │
│              (Protocol-Owned Liquidity Positions)                    │
└─────────────────────────────────────────────────────────────────────┘

Deployed Contracts (BSC Mainnet)

Core Infrastructure

Contract Address Description
OKS Token 0x614da16Af43A8Ad0b9F419Ab78d14D163DEa6488 Protocol governance token
OikosFactory 0x9F5973EC7E5f0781E0fCE71Dd949c997c38508Fc Main factory contract
Resolver 0xb9439a0f7d1Ef78d13905574B7ecd87B0Cd52aBE Address registry

Protocol Mechanics

Vault System

Each vault is a Diamond proxy (EIP-2535) managing:

  • Floor Liquidity - Concentrated liquidity at price floor
  • Anchor Liquidity - Active trading range liquidity
  • Discovery Liquidity - Liquidity at upper ranges for price discovery

Development

Prerequisites

Installation

# Clone the repository
git clone https://github.com/oikos-cash/core-contracts.git
cd core-contracts

# Install dependencies
forge install

# Build contracts
forge build

Testing

# Run all tests
forge test

# Run specific test file
forge test --match-path test/Lending.t.sol

# Run with verbosity
forge test -vvvv

# Run invariant tests
forge test --match-contract Invariant

# Gas report
forge test --gas-report

Test Coverage

forge coverage --report lcov

Deployment

# Deploy to BSC mainnet
forge script script/deploy/DeployFactory.s.sol:DeployFactory \
  --rpc-url https://bsc-dataseed.binance.org \
  --broadcast \
  --verify

Security

Audits

Security Features

  • Reentrancy Guards - All external calls protected
  • Access Control - Role-based permissions via modifiers
  • TWAP Oracles - MEV-resistant price feeds
  • Slippage Protection - Configurable deviation thresholds
  • Emergency Functions - Protocol pause capabilities

Bug Bounty

For responsible disclosure of security vulnerabilities, please contact: security@oikos.cash


Contract Verification

All contracts are verified on BscScan. Source code matches deployed bytecode.

# Verify a contract
forge verify-contract <ADDRESS> src/path/Contract.sol:Contract \
  --chain 56 \
  --etherscan-api-key <API_KEY>

Configuration

Protocol Parameters

Parameter Description Default
loanFee Daily loan fee (basis points) 57 (0.057%)
twapPeriod TWAP lookback period 120s
maxTwapDeviation Max price deviation (ticks) 200 (~2%)
minDuration Min presale duration 3 days
maxDuration Max presale duration 90 days

Integration

Reading Vault Data

interface IVault {
    function pool() external view returns (IUniswapV3Pool);
    function getFloorLiquidity() external view returns (uint256);
    function getCeilingLiquidity() external view returns (uint256);
    function getOutstandingLoans() external view returns (uint256);
}

Interacting with Factory

interface IOikosFactory {
    function deployVault(VaultDeployParams memory params) external returns (address);
    function getVaultFromPool(address pool) external view returns (address);
    function getProtocolParameters() external view returns (ProtocolParameters memory);
}

Project Structure

├── src/
│   ├── bootstrap/          # Presale contracts
│   ├── controllers/        # Supply & dividends controllers
│   ├── errors/             # Custom error definitions
│   ├── factory/            # Factory contracts
│   ├── interfaces/         # Contract interfaces
│   ├── libraries/          # Shared libraries
│   ├── model/              # Pricing models
│   ├── staking/            # Staking contracts
│   ├── token/              # OKS token implementations
│   ├── types/              # Type definitions
│   └── vault/              # Vault facets & upgrades
├── script/                 # Deployment & operation scripts
├── test/                   # Test suite
└── lib/                    # External dependencies

Dependencies


License

This project is licensed under the MIT License - see the LICENSE file for details.


Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Links


Built with love by the Oikos team

About

Core contracts of the Oikos protocol

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages