Squeeth Power Perpetual Protocol

repository·main·Indexed 42 days ago

https://github.com/opynfinance/squeeth-monorepo

A full-stack implementation of the Squeeth Power Perpetual protocol for trading an Eth² index. This monorepo includes smart contracts (Hardhat and Foundry), a Next.js frontend application, and subgraph services for indexing protocol data.

Tokens
43.1K
Snippets
192
Records
273
Agent score
52%

What's inside Squeeth

  1. What is Squeeth

    main

    Squeeth is a protocol designed for users to long or short a special index: Eth², serving as an implementation of a Power Perpetual.

    The monorepo contains the source code for the frontend application and the smart contracts. Developers can spin up a local environment, run tests, or interact with the code using the sub-packages provided.

  2. Explore Squeeth packages

    main

    The monorepo is organized into several packages. For specific implementation details, refer to the individual package directories:

    • @squeeth/hardhat: Contains the smart contracts and local development environment setup.
    • @squeeth/frontend: Contains the user interface application.
    • @squeeth/monorepo: BULL VAULT.
    • @squeeth/services: Graph Node Docker Image.
    • @squeeth/subgraph: SQUEETH-MONOREPO SUBGRAPH.
  3. Explore Squeeth Strategy Contracts

    main

    Squeeth utilizes various strategies for protocol operations. Strategies are organized into specific implementations and base classes located in docs/contracts-documentation/strategy/:

    Specific Strategies

    • CrabStrategy: A specific implementation of a protocol strategy.

    Base Strategy Classes

    These provide the foundational logic for building new strategies:

    • StrategyBase: The primary base class for all strategies.
    • StrategyFlashSwap: Base logic for strategies involving flash swaps.
    • StrategyMath: Base logic for mathematical operations within strategies.
  4. Explore Squeeth Libraries and Periphery

    main

    The protocol includes utility libraries and periphery contracts to support core operations:

    Libraries

    Found in docs/contracts-documentation/libs/:

    • OracleLibrary: Utility functions for oracle interactions.
    • Power2Base: Mathematical utilities for power-to-base conversions.
    • VaultLib: Utilities for vault management.

    Periphery

    Found in docs/contracts-documentation/periphery/:

    • ShortHelper: A helper contract designed to simplify shorting interactions.
  5. Explore Squeeth Core Contracts

    main

    The core of the Squeeth protocol is built around several key smart contracts that manage the primary financial logic. You can find detailed documentation for each of these components in the docs/contracts-documentation/core/ directory:

    • Controller: Manages the high-level logic and orchestration of the protocol.
    • Oracle: Provides price feeds and data necessary for protocol operations.
    • ShortPowerPerp: Handles the logic for short power perpetual contracts.
    • WPowerPerp: Handles the logic for long power perpetual contracts.
  6. Identify Prohibited Activities on the Interface

    main

    Users are prohibited from using the Interface for the following "Prohibited Uses":

    • Legal Violations: Any activity violating anti-money laundering (AML), anti-terrorist financing (CFT) laws (e.g., Bank Secrecy Act, OFAC), or market integrity laws (e.g., spoofing, wash trading).
    • Intellectual Property Infringement: Selling or distributing counterfeit software or unauthorized materials, or using Opyn's Intellectual Property without consent.
    • System Interference: Deploying viruses, performing denial-of-service (DoS) attacks, or using automated tools (robots, spiders, crawlers, scrapers) to extract data or impose unreasonable loads on infrastructure.
    • Fraudulent Activity: Providing false or misleading information to obtain property or implying an untrue affiliation with Opyn.
    • Harassment: Using the Interface to stalk, harass, bully, or engage in defamatory, obscene, or threatening behavior.
  7. Validate Uniswap V3 Pool callbacks with CallbackValidation

    main
    The CallbackValidation contract provides utility functions to ensure that callbacks received during a flash swap originate from a legitimate Uniswap V3 Pool. This is critical for preventing spoofing attacks where an attacker might attempt to call your contract's callback function from a malicious contract instead of a real Uniswap V3 pool.
  8. Manage Gas and Transaction Fees

    main

    Users are responsible for all costs associated with interacting with the Interface and Protocol.

    Fees:

    • You may be required to pay fees, including third-party fees, unless a specific promotion applies.
    • Fee information provided by the Interface is an estimate and may vary from the actual fees paid.

    Gas:

    • Requirement: You must maintain an adequate amount of Digital Assets to serve as Gas within your Digital Wallet to process transactions.
    • Failure to provide Gas: If you fail to maintain adequate Gas, transactions will not be processed. Opyn is not responsible for delays caused by insufficient Gas.
    • Non-refundable: Gas consumption is subject to the Blockchain Technology and cannot be returned.
  9. Review Opyn's Assumption of Risk and Digital Asset Volatility

    main

    Using blockchain technology and transacting Digital Assets involves significant risks. Users must assume all risks related to:

    • Hacking, security breaches, flaws, errors, bugs, or fraud in the Digital Assets or Blockchain Technology.
    • Loss of value due to forks, rollbacks, or market manipulation.
    • Increased transaction costs impacting Interface usage.
    • Loss of access due to service provider support cessation or governmental/regulatory actions.

    Users are responsible for conducting independent analysis and should only acquire Digital Assets if they can afford to lose the entire value.

  10. Understand Squeeth support for The Merge and chain forks

    main

    Opyn/Squeeth supports The Merge and will only operate on the canonical Ethereum chain moving to Proof of Stake (PoS).

    Key implications for users:

    • No Fork Support: The Squeeth interface will not support forked PoW versions of Squeeth, vault NFTs, or Crab Vault receipt tokens if a canonical PoW ETH fork emerges.
    • No Action Required: Assuming a successful transition, the Squeeth Protocol and the Opyn web app (opyn.co) will continue to function without manual user intervention.
    • Infrastructure Risks: Brief periods of unavailability may occur if third-party infrastructure providers (e.g., node providers) experience downtime during the transition.
  11. Understand arbitration rules and exceptions

    main

    Most disputes with Opyn are resolved through binding arbitration administered by JAMS under the Federal Arbitration Act (FAA).

    Key Arbitration Details:

    • Rules: Governed by JAMS Streamlined Arbitration Rules and Procedures.
    • Location: San Francisco, CA (or as otherwise agreed).
    • Small Claims: Disputes not exceeding $15,000 may be arbitrated solely via pleadings and documents.
    • Fees: Both parties are responsible for paying their own fees related to arbitration resolution.
    • Statute of Limitations: Any claim related to the Interface, Protocol, or the Agreement must be filed within one (1) year of the cause of action arising.

    Exceptions (Claims handled in court instead of arbitration):

    • Claims related to actual or threatened infringement, misappropriation, or violation of intellectual property rights (copyrights, trademarks, trade secrets, patents).
    • Claims seeking emergency injunctive relief due to exigent circumstances (e.g., imminent danger or crime).
    • Disputes regarding the enforceability or validity of the Class Action Waiver.