Skip to content

Instantly share code, notes, and snippets.

@yubrew
Last active August 6, 2024 03:15
Show Gist options
  • Save yubrew/7fab65f877f4215e548f654addbd4351 to your computer and use it in GitHub Desktop.
Save yubrew/7fab65f877f4215e548f654addbd4351 to your computer and use it in GitHub Desktop.

Version 1

graph TD
    User((User))
    BondDepo[Bond Depo]
    Treasury[Treasury]
    Distributor[Distributor]
    Allocator[Allocator]
    Staking[Staking]
    OHM((OHM))
    sOHM((sOHM))

    User -->|call deposit\nsend reserves| BondDepo
    User -->|call redeem\nreceives OHM| BondDepo
    BondDepo -->|deposit| Treasury
    BondDepo -->|mintRewards| Staking
    Distributor -->|call mintRewards| Treasury
    Treasury -->|mint| OHM
    Allocator -->|call manage\nsend reserves| Treasury
    Allocator -->|call deposit\nsend reserves| Treasury
    Treasury -->|manage reserves| Allocator
    Staking -->|rebase by amount| sOHM
    OHM -->|deposit| Staking
    Staking -->|mintRewards| OHM

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px;
    classDef token fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef user fill:#98fb98,stroke:#333,stroke-width:2px;
    class OHM,sOHM token;
    class User user;
Loading

Version 2

flowchart TD
    subgraph Users["Users"]
        User((User))
        Holder((OHM Holder))
    end

    subgraph Core["Core Protocol"]
        Treasury[Treasury]
        Staking[Staking]
        BondDepo[Bond Depository]
    end

    subgraph Tokens["Protocol Tokens"]
        OHM((OHM))
        sOHM((sOHM))
        gOHM((gOHM))
    end

    subgraph PolicyMakers["Policy Makers"]
        Distributor[Distributor]
        Allocator[Allocator]
    end

    User -->|Buy bonds| BondDepo
    User -->|Stake OHM| Staking
    Holder -->|Unstake| Staking
    BondDepo -->|Deposit assets| Treasury
    BondDepo -->|Request OHM| Treasury
    Treasury -->|Mint OHM| OHM
    Treasury -->|Send OHM| BondDepo
    BondDepo -->|Send OHM| User
    Treasury -->|Allocate funds| Allocator
    Allocator -->|Manage reserves| Treasury
    Distributor -->|Request OHM minting| Treasury
    Treasury -->|Send OHM| Distributor
    Distributor -->|Distribute OHM rewards| Staking
    Staking -->|Mint| sOHM
    Staking -->|Mint| gOHM
    OHM -->|Stake| Staking
    sOHM -->|Unstake| Staking
    gOHM -->|Unstake| Staking
    Staking -->|Rebase| sOHM

    classDef user fill:#98fb98,stroke:#333,stroke-width:2px;
    classDef token fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef core fill:#f0f8ff,stroke:#333,stroke-width:2px;
    classDef policy fill:#ffe4e1,stroke:#333,stroke-width:2px;
    class User,Holder user;
    class OHM,sOHM,gOHM token;
    class Treasury,Staking,BondDepo core;
    class Distributor,Allocator policy;

    linkStyle default stroke-width:2px,fill:none,stroke:gray;

    %% Improved subgraph styling with contrasting colors
    style Users fill:#e6fff2,stroke:#333,stroke-width:2px;
    style Core fill:#e6f2ff,stroke:#333,stroke-width:2px;
    style Tokens fill:#fff2e6,stroke:#333,stroke-width:2px;
    style PolicyMakers fill:#ffe6e6,stroke:#333,stroke-width:2px;

    %% Add contrasting colors to subgraph titles
    style Users color:#000000,font-weight:bold;
    style Core color:#000000,font-weight:bold;
    style Tokens color:#000000,font-weight:bold;
    style PolicyMakers color:#000000,font-weight:bold;
Loading

Version 3

flowchart TD
    subgraph External["External Ecosystem"]
        User((User))
        DAI[(DAI)]
        FRAX[(FRAX)]
        WETH[(WETH)]
    end

    subgraph Core["Core Protocol"]
        direction TB
        Treasury["Treasury |<br> - Manage assets<br> - Mint OHM"]
        Staking["Staking |<br> - Stake/Unstake OHM<br> - Distribute rewards"]
        BondDepo["Bond Depository |<br> - Sell bonds<br> - Manage discounts"]
    end

    subgraph Tokens["OHM Tokens"]
        direction LR
        OHM((OHM))
        sOHM((sOHM))
        gOHM((gOHM))
        wsOHM((wsOHM))
    end

    subgraph Governance["Governance & Policy"]
        DAO{"DAO"}
        PolicyTeam["Policy Team"]
    end

    subgraph DeFi["DeFi Integrations"]
        direction TB
        Lending["Lending Platforms"]
        DEX["Decentralized Exchanges"]
        Yield["Yield Farming"]
    end

    User -->|Buy bonds| BondDepo
    User -->|Stake OHM| Staking
    User -->|Trade| DEX
    DAI & FRAX & WETH -->|Bonding| BondDepo
    BondDepo -->|Assets| Treasury
    Treasury -->|OHM| BondDepo
    Treasury -->|Allocate| DeFi
    Treasury -.->|Governed by| DAO
    PolicyTeam -->|Set parameters| Treasury
    PolicyTeam -->|Adjust rates| Staking
    PolicyTeam -->|Configure| BondDepo
    Staking -->|Mint/Burn| sOHM
    Staking -->|Mint/Burn| gOHM
    OHM -->|Stake| Staking
    sOHM -->|Wrap| wsOHM
    gOHM -.->|Index adjusted| sOHM
    OHM & sOHM & gOHM & wsOHM -->|Provide liquidity| DEX
    OHM & sOHM & gOHM & wsOHM -->|Collateral| Lending
    Treasury -->|Rewards| Staking
    Yield -->|Returns| Treasury
    DAO -->|Proposals| PolicyTeam

    classDef external fill:#f0f8ff,stroke:#333,stroke-width:2px;
    classDef core fill:#e6fffa,stroke:#333,stroke-width:2px;
    classDef token fill:#fff5e6,stroke:#333,stroke-width:2px;
    classDef governance fill:#ffe6e6,stroke:#333,stroke-width:2px;
    classDef defi fill:#e6fff2,stroke:#333,stroke-width:2px;
    classDef stablecoin fill:#e6e6ff,stroke:#333,stroke-width:2px;
    
    class User,DAI,FRAX,WETH external;
    class Treasury,Staking,BondDepo core;
    class OHM,sOHM,gOHM,wsOHM token;
    class DAO,PolicyTeam governance;
    class Lending,DEX,Yield defi;
    class DAI,FRAX stablecoin;

    linkStyle default stroke:#666,stroke-width:2px;
    linkStyle 10,11,12,13 stroke:#ff9999,stroke-width:2px;
    linkStyle 18,19,20,21 stroke:#99ff99,stroke-width:2px;

    %% Improved subgraph styling with contrasting colors
    style External fill:#f9f9f9,stroke:#333,stroke-width:4px;
    style Core fill:#f0f0f0,stroke:#333,stroke-width:4px;
    style Tokens fill:#fff0f0,stroke:#333,stroke-width:4px;
    style Governance fill:#f0fff0,stroke:#333,stroke-width:4px;
    style DeFi fill:#f0f0ff,stroke:#333,stroke-width:4px;

    %% Add contrasting colors to subgraph titles
    style External color:#000000,font-weight:bold;
    style Core color:#000000,font-weight:bold;
    style Tokens color:#000000,font-weight:bold;
    style Governance color:#000000,font-weight:bold;
    style DeFi color:#000000,font-weight:bold;
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment