### Start Frontend Development Server Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/README.md Installs dependencies and starts the frontend development server. Navigate to the frontend package directory first. ```bash cd packages/frontend yarn install yarn dev ``` -------------------------------- ### Install and Start Hardhat Chain Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/README.md Installs dependencies and starts the Hardhat local blockchain. Navigate to the hardhat package directory first. ```bash cd packages/hardhat yarn install yarn chain ``` -------------------------------- ### Initialize Foundry Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/README.md Start the Foundry toolchain. ```bash foundryup ``` -------------------------------- ### Start Development Server Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/frontend/README.md Execute this command to start the Next.js development server. Open http://localhost:3000 in your browser to view the application. ```bash yarn dev ``` -------------------------------- ### Install Node Dependencies Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/frontend/README.md Run this command to install all necessary node dependencies for the project. ```bash yarn install ``` -------------------------------- ### Install Foundry Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/README.md Download and install Foundry on Linux or macOS systems. ```bash curl -L https://foundry.paradigm.xyz | bash ``` -------------------------------- ### Install Dependencies Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/README.md Install project dependencies using Forge. ```bash forge install ``` -------------------------------- ### Start Services with Docker Compose Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/services/graph-node/README.md Command to initialize the full stack including IPFS, Postgres, and the Graph Node. ```sh docker-compose up ``` -------------------------------- ### Start Local Hardhat Chain Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/README.md Starts a local Hardhat development chain. This is a prerequisite for deploying contracts locally. ```shell yarn chain ``` -------------------------------- ### Prepare Subgraph for Environment Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/subgraph/README.md Prepare the subgraph for a specific network environment. Use 'ropsten' or 'mainnet' as examples. ```bash yarn prepare:ropsten ``` ```bash yarn prepare:mainnet ``` -------------------------------- ### Run Graph Node with Docker Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/services/graph-node/README.md Standard command to start the Graph Node container with required environment variables for database, IPFS, and Ethereum node connectivity. ```sh docker run -it \ -e postgres_host=[:] \ -e postgres_user= \ -e postgres_pass= \ -e postgres_db= \ -e ipfs=: \ -e ethereum=: \ graphprotocol/graph-node:latest ``` ```sh docker run -it \ -e postgres_host=host.docker.internal:5432 -e postgres_user=graph-node \ -e postgres_pass=oh-hello \ -e postgres_db=graph-node \ -e ipfs=host.docker.internal:5001 \ -e ethereum=mainnet:http://localhost:8545/ \ graphprotocol/graph-node:latest ``` -------------------------------- ### Get wSqueeth from Crab Amount Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/strategy/CrabStrategy.md Calculates the equivalent wSqueeth amount for a given crab token amount. ```solidity getWsqueethFromCrabAmount(uint256 _crabAmount) ``` -------------------------------- ### Queue ETH for Deposit Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Internal function to queue ETH for deposit into ZenBull. No specific setup is required beyond calling this function within the contract. ```solidity function _queueEth() internal; ``` -------------------------------- ### Constructor Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/ShortPowerPerp.md Initializes the ShortPowerPerp contract with a name and symbol. ```APIDOC ## Constructor ### Description Initializes the short power perpetual contract. ### Parameters #### Path Parameters - **_name** (string) - Required - Token name for ERC721 - **_symbol** (string) - Required - Token symbol for ERC721 ``` -------------------------------- ### GET /nextId Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/interfaces/IShortPowerPerp.md Retrieves the next available ID for an NFT. ```APIDOC ## GET /nextId ### Description Returns the next available ID for an NFT. ### Method GET ### Response #### Success Response (200) - **id** (uint256) - The next available NFT ID. ``` -------------------------------- ### init Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/ShortPowerPerp.md Initializes the short contract with a controller address. ```APIDOC ## init ### Description Initializes the short contract. ### Parameters #### Request Body - **_controller** (address) - Required - Controller address ``` -------------------------------- ### Configure Environment Variables for Testing Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/frontend/cypress/TEST.md Set up your SECRET_WORDS or PRIVATE_KEY and NETWORK in the .env file for testing. Ensure the network is set to 'ropsten'. ```jsx SECRET_WORDS = 'word1, word2, word3...' NETWORK_NAME = ropsten OR PRIVATE_KEY = 'your PRIVATE_KEY' NETWORK_NAME = ropsten ``` -------------------------------- ### GET checkOrder Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Validates an order by checking its expiry, nonce, and signer. ```APIDOC ## GET checkOrder ### Description Checks the expiry nonce and signer of an order to ensure validity. ### Method GET ### Endpoint checkOrder(Order _order) ### Parameters #### Request Body - **_order** (Order) - Required - The Order struct to validate ### Response #### Success Response (200) - **isValid** (bool) - Returns true if the order is valid ``` -------------------------------- ### GET getWithdrawReceipt Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Retrieves details of a specific withdrawal receipt by its index. ```APIDOC ## GET getWithdrawReceipt ### Description Fetches the withdrawal receipt information for a given index. ### Method GET ### Endpoint getWithdrawReceipt(uint256 _index) ### Parameters #### Path Parameters - **_index** (uint256) - Required - Withdraw index in withdraws array ### Response #### Success Response (200) - **receipt** (tuple) - Returns address (sender), uint256 (amount), and uint256 (timestamp) ``` -------------------------------- ### GET getDepositReceipt Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Retrieves details of a specific deposit receipt by its index. ```APIDOC ## GET getDepositReceipt ### Description Fetches the deposit receipt information for a given index. ### Method GET ### Endpoint getDepositReceipt(uint256 _index) ### Parameters #### Path Parameters - **_index** (uint256) - Required - Deposit index in deposits array ### Response #### Success Response (200) - **receipt** (tuple) - Returns address (sender), uint256 (amount), and uint256 (timestamp) ``` -------------------------------- ### GET /checkTimeHedge Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/strategy/CrabStrategy.md Checks if hedging based on time threshold is allowed. ```APIDOC ## GET /checkTimeHedge ### Description Checks if hedging based on time threshold is allowed. ### Method GET ### Response #### Success Response (200) - **isTimeHedgeAllowed** (bool) - True if hedging is allowed - **auctionTriggertime** (uint256) - Auction trigger timestamp ``` -------------------------------- ### WPowerPerp Init Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/WPowerPerp.md Initializes the WPowerPerp contract with a controller address. ```APIDOC ## init init(address _controller) ### Description init wPowerPerp contract ### Parameters: #### Path Parameters - **_controller** (address) - Required - controller address ``` -------------------------------- ### GET /checkPriceHedge Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/strategy/CrabStrategy.md Checks if hedging based on price threshold is allowed. ```APIDOC ## GET /checkPriceHedge ### Description Checks if hedging based on price threshold is allowed. ### Method GET ### Parameters #### Query Parameters - **_auctionTriggerTime** (uint256) - Required - Alleged timestamp where auction was triggered ### Response #### Success Response (200) - **result** (uint256) - true if hedging is allowed ``` -------------------------------- ### Prepare Subgraph for Mainnet Deployment Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/subgraph/README.md Prepare the subgraph for deployment on the mainnet. This is a prerequisite for building and deploying. ```bash yarn prepare:mainnet ``` -------------------------------- ### WPowerPerp Constructor Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/WPowerPerp.md Initializes the WPowerPerp ERC20 token with a name and symbol. ```APIDOC ## constructor constructor(string _name, string _symbol) ### Description long power perpetual constructor ### Parameters: #### Path Parameters - **_name** (string) - Required - token name for ERC20 - **_symbol** (string) - Required - token symbol for ERC20 ``` -------------------------------- ### GET depositsQueued Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Retrieves the total sum of ETH currently in the deposit queue. ```APIDOC ## GET depositsQueued ### Description Returns the sum of ETH amount currently waiting in the deposit queue. ### Method GET ### Endpoint depositsQueued() ### Response #### Success Response (200) - **sum** (uint256) - Sum ETH amount in queue ``` -------------------------------- ### Constructor for ZenBullNetting Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Initializes the ZenBullNetting contract with addresses for core dependencies and sets up EIP712 and FlashSwap configurations. ```solidity constructor(address _zenBull, address _eulerSimpleLens, address _flashZenBull, address _uniFactory) EIP712("ZenBullNetting", "1") FlashSwap(_uniFactory); ``` -------------------------------- ### GET withdrawsQueued Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Retrieves the total sum of ZenBull tokens currently in the withdrawal queue. ```APIDOC ## GET withdrawsQueued ### Description Returns the sum of ZenBull amount currently waiting in the withdrawal queue. ### Method GET ### Endpoint withdrawsQueued() ### Response #### Success Response (200) - **sum** (uint256) - Sum ZenBull amount in queue ``` -------------------------------- ### MockController Initialization Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/mocks/MockController.md Initializes the MockController contract with addresses for shortPowerPerp and wPowerPerp. ```APIDOC ## POST /mockController/init ### Description Initializes the MockController contract. ### Method POST ### Endpoint /mockController/init ### Parameters #### Request Body - **_shortPowerPerp** (address) - Required - The address of the shortPowerPerp contract. - **_wPowerPerp** (address) - Required - The address of the wPowerPerp contract. ``` -------------------------------- ### Get Crab Token Address Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/IZenBullStrategy.sol/contract.IZenBullStrategy.md Returns the address of the crab token. This is a view function. ```solidity function crab() external view returns (address); ``` -------------------------------- ### GET /getWsqueethFromCrabAmount Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/strategy/CrabStrategy.md Retrieves the wSqueeth debt amount associated with a specific crab token amount. ```APIDOC ## GET /getWsqueethFromCrabAmount ### Description Retrieves the wSqueeth debt amount associated with a specific crab token amount. ### Method GET ### Parameters #### Query Parameters - **_crabAmount** (uint256) - Required - Strategy token amount ### Response #### Success Response (200) - **wSqueethAmount** (uint256) - The wSqueeth debt amount ``` -------------------------------- ### Deploy Contract Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/README.md Execute the deployment script for the specified network using environment variables. ```shell $ source .env $ forge script script/MainnetDeployScript.s.sol:MainnetDeployScript --rpc-url $MAINNET_RPC_URL --broadcast --verify -vvvv ``` -------------------------------- ### Get ETH/WSqueeth Pool Address - ICrabStrategyV2 Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/ICrabStrategyV2.sol/contract.ICrabStrategyV2.md Returns the address of the liquidity pool for ETH and WSqueeth. ```solidity function ethWSqueethPool() external view returns (address); ``` -------------------------------- ### POST /openShort Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Open a short position by minting oSQTH, swapping to ETH on Uniswap, and receiving the premium. ```APIDOC ## POST /openShort ### Description Open a short position by minting oSQTH, swapping to ETH on Uniswap, and receiving the premium. ### Method POST ### Parameters #### Request Body - **_vaultId** (uint256) - Required - 0 for new vault - **_powerPerpAmount** (uint256) - Required - oSQTH to mint/sell - **_uniNftId** (uint256) - Required - Optional LP NFT collateral - **_exactInputParams** (ISwapRouter.ExactInputSingleParams) - Required - Swap parameters ``` -------------------------------- ### StrategyBase Constructor Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/strategy/base/StrategyBase.md Initializes the StrategyBase contract, setting up the power token controller, WETH address, and strategy token details. ```APIDOC ## constructor StrategyBase ### Description Initializes the StrategyBase contract. This function opens a vault in the power token contract and stores the vault ID. ### Parameters: #### Path Parameters - **_powerTokenController** (address) - Required - power token controller address - **_weth** (address) - Required - weth token address - **_name** (string) - Required - token name for strategy ERC20 token - **_symbol** (string) - Required - token symbol for strategy ERC20 token ``` -------------------------------- ### Get Index Price Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/Controller.md Fetches the scaled-down index price of the powerPerp, used for funding and collateralization calculations. ```APIDOC ## getIndex(uint32 _period) → uint256 /opynfinance/squeeth-monorepo/contracts/Controller.sol ### Description Get the index price of the powerPerp, scaled down. The index price is scaled down by INDEX_SCALE in the associated PowerXBase library. This is the index price used when calculating funding and for collateralization. ### Method GET ### Endpoint /getIndex ### Parameters: #### Query Parameters - **_period** (uint32) - Required - period which you want to calculate twap with ### Return Values: - **uint32**: index price denominated in $USD, scaled by 1e18 ``` -------------------------------- ### Clone Repository Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/README.md Clone the squeeth-monorepo and navigate to the zen-bull-netting package directory. ```bash git clone https://github.com/opynfinance/squeeth-monorepo && cd packages/zen-bull-netting ``` -------------------------------- ### Get Denormalized Mark Price Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/Controller.md Calculates the mark price of powerPerp after funding by dividing the TWAP by the normalization factor. ```APIDOC ## getDenormalizedMark(uint32 _period) → uint256 /opynfinance/squeeth-monorepo/contracts/Controller.sol ### Description Get the mark price (after funding) of powerPerp as the twap divided by the normalization factor. ### Method GET ### Endpoint /getDenormalizedMark ### Parameters: #### Query Parameters - **_period** (uint32) - Required - period of time for the twap in seconds ### Return Values: - **uint32**: mark price denominated in $USD, scaled by 1e18 ``` -------------------------------- ### Authenticate with Hosted Service Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/subgraph/README.md Store your access token to authenticate with the hosted service. Replace with your actual token. ```bash graph auth --product hosted-service ``` -------------------------------- ### Get Crab Vault Details Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/IZenBullStrategy.sol/contract.IZenBullStrategy.md Retrieves details about the crab vault, returning two uint256 values. This is a view function. ```solidity function getCrabVaultDetails() external view returns (uint256, uint256); ``` -------------------------------- ### Deploy Subgraph to Mainnet Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/subgraph/README.md Deploy the compiled subgraph to the mainnet. Replace '*******' with your deploy key. ```bash yarn deploy --deploy-key ******* ``` -------------------------------- ### Get Crab Balance Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/IZenBullStrategy.sol/contract.IZenBullStrategy.md Retrieves the current balance of crab tokens. This is a view function and does not change the contract's state. ```solidity function getCrabBalance() external view returns (uint256); ``` -------------------------------- ### Deploy Subgraph to Ropsten Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/subgraph/README.md Deploy the compiled subgraph to the Ropsten network. Replace '*******' with your deploy key. ```bash yarn deploy:ropsten --deploy-key ******* ``` -------------------------------- ### GET getTwap Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/IOracle.sol/contract.IOracle.md Retrieves the Time-Weighted Average Price (TWAP) for a given pool, base, and quote asset over a specified period. ```APIDOC ## GET getTwap ### Description Retrieves the TWAP for a specific pool, base, and quote asset over a defined period. ### Method GET ### Parameters #### Path Parameters - **_pool** (address) - Required - The address of the pool. - **_base** (address) - Required - The address of the base asset. - **_quote** (address) - Required - The address of the quote asset. - **_period** (uint32) - Required - The time period for the TWAP calculation. - **_checkPeriod** (bool) - Required - Flag to determine if the period should be validated. ### Response #### Success Response (200) - **returns** (uint256) - The calculated TWAP value. ``` -------------------------------- ### Calculate Flash Deposit Amounts (TypeScript) Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt This hook calculates the optimal amounts for a flash deposit strategy, including the amount of ETH to borrow, minimum output amounts, price impact, and initial oSQTH debt. It requires the deposit amount and slippage tolerance. ```TypeScript import { useCalculateETHtoBorrowFromUniswapV2 } from '@state/crab/hooks'; const calculateETHtoBorrow = useCalculateETHtoBorrowFromUniswapV2(); // Calculate for 5 ETH deposit with 0.5% slippage const { ethBorrow, // ETH to borrow minimumAmountOut, // Min ETH from oSQTH sale priceImpact, // Price impact percentage initialWSqueethDebt // oSQTH to mint } = await calculateETHtoBorrow( new BigNumber(5), // ETH deposit 0.5 // slippage % ); console.log(`Will borrow ${ethBorrow.toString()} ETH`); console.log(`Price impact: ${priceImpact}%`); ``` -------------------------------- ### Get Domain Separator Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md A view function that returns the domain separator used for EIP712 signing. This is useful for off-chain signature verification. ```solidity function DOMAIN_SEPARATOR() external view returns (bytes32); ``` -------------------------------- ### receive() Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/Controller.md Fallback function to accept ETH. ```APIDOC ## receive() ### Description This is a fallback function designed to accept incoming ETH transfers to the contract. ### Method POST ### Endpoint /receive ### Parameters None ### Request Example ```json { "message": "Receive ETH" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates that ETH was received. #### Response Example ```json { "status": "ETH received successfully" } ``` ``` -------------------------------- ### Compile Squeeth Contracts Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/README.md Use this command to compile the smart contracts within the Squeeth project. ```shell yarn compile ``` -------------------------------- ### Get Expected Normalization Factor Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/Controller.md Retrieves the expected normalization factor, useful for on-chain and off-chain calculations, especially when funding is being paid. ```APIDOC ## getExpectedNormalizationFactor() → uint256 /opynfinance/squeeth-monorepo/contracts/Controller.sol ### Description Returns the expected normalization factor, if the funding is paid right now. Can be used for on-chain and off-chain calculations. ### Method GET ### Endpoint /getExpectedNormalizationFactor ### Return Values: - **uint256**: The expected normalization factor. ``` -------------------------------- ### Auction Live State Variable Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md A boolean flag indicating whether an auction is currently active. The owner sets this to true when starting an auction. ```Solidity bool public isAuctionLive; ``` -------------------------------- ### MockController Mint WPowerPerp Amount Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/mocks/MockController.md Mints a specified amount of wPowerPerp for a given vault ID. ```APIDOC ## POST /mockController/mintWPowerPerpAmount ### Description Mints wPowerPerp amount for a given vault. ### Method POST ### Endpoint /mockController/mintWPowerPerpAmount ### Parameters #### Request Body - **_vaultId** (uint256) - Required - The ID of the vault. - **_mintAmount** (uint128) - Required - The amount of wPowerPerp to mint. - **arg3** (uint256) - Required - An unspecified uint256 argument. ``` -------------------------------- ### Run Test Suites Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/README.md Execute tests using different Foundry profiles to manage compilation and testing scope. ```bash FOUNDRY_PROFILE=test forge test # run only test functions FOUNDRY_PROFILE=fuzz forge test # run only fuz testing (function with name that include "Fuzzing") FOUNDRY_PROFILE=coverage forge coverage # coverage report ``` -------------------------------- ### Get Expected Normalization Factor Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Retrieves the current normalization factor, which is used to adjust the effective debt amount based on funding payments. ```APIDOC ## GET /getExpectedNormalizationFactor ### Description Returns the expected normalization factor after applying funding. The norm factor adjusts the effective debt amount based on funding payments. ### Method GET ### Endpoint /getExpectedNormalizationFactor ### Parameters None ### Request Example None ### Response #### Success Response (200) - **normFactor** (uint256) - The expected normalization factor. #### Response Example ```json { "normFactor": "1000000000000000000" } ``` ``` -------------------------------- ### Get Vault Details - ICrabStrategyV2 Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/ICrabStrategyV2.sol/contract.ICrabStrategyV2.md Retrieves detailed information about the vault, including addresses and amounts. Use this to inspect the current state of the vault. ```solidity function getVaultDetails() external view returns (address, uint256, uint256, uint256); ``` -------------------------------- ### closeShort Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/periphery/ShortHelper.md Buys back wPowerPerp with ETH on Uniswap V3 and closes the specified position. ```APIDOC ## closeShort ### Description Buy back wPowerPerp with eth on uniswap v3 and close position. ### Parameters #### Path Parameters - **_vaultId** (uint256) - Required - Short wPowerPerp vault id - **_wPowerPerpAmount** (uint256) - Required - Amount of wPowerPerp to mint/sell - **_withdrawAmount** (uint128) - Required - Amount to withdraw - **_exactOutputParams** (ISwapRouter.ExactOutputSingleParams) - Required - Uniswap V3 swap parameters ``` -------------------------------- ### Run Coverage Tests Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/README.md Generate a code coverage report. The report will be available at '/coverage/index.html'. ```shell yarn coverage ``` -------------------------------- ### Get Unscaled Index Price Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/Controller.md Retrieves the expected mark price of powerPerp after funding has been applied, indicating the price for future funding calculations. ```APIDOC ## getUnscaledIndex(uint32 _period) → uint256 /opynfinance/squeeth-monorepo/contracts/Controller.sol ### Description Get the expected mark price of powerPerp after funding has been applied. This is the mark that would be be used for future funding after a new normalization factor is applied. ### Method GET ### Endpoint /getUnscaledIndex ### Parameters: #### Query Parameters - **_period** (uint32) - Required - period which you want to calculate twap with ### Return Values: - **uint32**: index price denominated in $USD, scaled by 1e18 ``` -------------------------------- ### Get Sum of Queued ZenBull Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md External view function to retrieve the total amount of ZenBull currently queued for withdrawal. This function does not modify state. ```solidity function withdrawsQueued() external view returns (uint256); ``` -------------------------------- ### Copy Config and ABIs from Hardhat Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/subgraph/README.md Run this script to copy ABIs and create configuration files from the hardhat package to the subgraph folder. ```bash node scripts/publish.js ``` -------------------------------- ### openShort Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/periphery/ShortHelper.md Mints power perp, trades it on Uniswap V3, and returns the premium in ETH to the user. ```APIDOC ## openShort ### Description Mints power perp, trades with uniswap v3 and sends back premium in eth. ### Parameters #### Path Parameters - **_vaultId** (uint256) - Required - Short wPowerPerp vault id - **_powerPerpAmount** (uint128) - Required - Amount of powerPerp to mint/sell - **_uniNftId** (uint256) - Required - Uniswap v3 position token id - **_exactInputParams** (ISwapRouter.ExactInputSingleParams) - Required - Uniswap V3 swap parameters ``` -------------------------------- ### Oracle API - Get Average Tick Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Returns the time-weighted average tick for a Uniswap pool, useful for price calculations without decimal conversion. ```APIDOC ## GET /oracle/getTimeWeightedAverageTickSafe ### Description Returns the time-weighted average tick for a Uniswap pool, useful for price calculations without decimal conversion. ### Method GET ### Endpoint /oracle/getTimeWeightedAverageTickSafe ### Parameters #### Path Parameters None #### Query Parameters - **_pool** (address) - Required - The address of the Uniswap V3 pool. - **_period** (uint32) - Required - The TWAP period in seconds. ### Request Example ```bash curl -X GET "/oracle/getTimeWeightedAverageTickSafe?_pool=0x...&_period=420" ``` ### Response #### Success Response (200) - **timeWeightedAverageTick** (int24) - The time-weighted average tick. #### Response Example ```json { "timeWeightedAverageTick": "12345" } ``` ``` -------------------------------- ### Run Default Tests Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/README.md Execute tests on the default Hardhat network. Ensure your environment is set up correctly for testing. ```shell yarn test ``` -------------------------------- ### Get Power Token Controller Address Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/IZenBullStrategy.sol/contract.IZenBullStrategy.md Retrieves the address of the power token controller. This function is a view function and does not modify the contract's state. ```solidity function powerTokenController() external view returns (address); ``` -------------------------------- ### ZenBullNetting Contract Overview Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Provides an overview of the ZenBullNetting contract, including its inheritance, author, and error codes. ```APIDOC ## ZenBullNetting Contract This contract is responsible for netting deposits and withdrawals in the ZenBull system. ### Inheritance - Ownable - EIP712 - FlashSwap ### Author - Opyn team ### Error Codes - ZBN01: Auction TWAP is less than min value - ZBN02: OTC price tolerance is greater than max OTC tolerance price - ZBN03: Amount to queue for deposit is less than min amount - ZBN04: Can not dequeue deposited amount because auction is already live and force dequeued not activated - ZBN05: Amount of ETH to deposit left in the queue is less than min amount - ZBN06: Queued deposit is not longer than 1 week to force dequeue - ZBN07: Amount of ZenBull to queue for withdraw is less than min amount - ZBN08: Amount of ZenBull to withdraw left in the queue is less than min amount - ZBN09: Queued withdraw is not longer than 1 week to force dequeue - ZBN10: ETH quantity to net is less than queued for deposits - ZBN11: ZenBull quantity to net is less than queued for withdraws - ZBN12: ZenBull Price too high - ZBN13: ZenBull Price too low - ZBN14: Clearing price too high relative to Uniswap twap - ZBN15: Clearing price too low relative to Uniswap twap - ZBN16: Invalid order signer - ZBN17: Order already expired - ZBN18: Nonce already used - ZBN19: auction order is not selling - ZBN20: sell order price greater than clearing - ZBN21: auction order is not buying - ZBN22: buy order price greater than clearing - ZBN23: not enough buy orders for sqth - ZBN24: not authorized to perform netting at price ``` -------------------------------- ### Get Denormalized Mark Price For Funding Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/Controller.md Retrieves the mark price of powerPerp before funding, used to calculate a new normalization factor if funding were calculated now. ```APIDOC ## getDenormalizedMarkForFunding(uint32 _period) → uint256 /opynfinance/squeeth-monorepo/contracts/Controller.sol ### Description Get the mark price of powerPerp before funding has been applied. This is the mark that would be used to calculate a new normalization factor if funding was calculated now. ### Method GET ### Endpoint /getDenormalizedMarkForFunding ### Parameters: #### Query Parameters - **_period** (uint32) - Required - period which you want to calculate twap with ### Return Values: - **uint32**: mark price denominated in $USD, scaled by 1e18 ``` -------------------------------- ### Deploy Contracts to Testnet Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/README.md Deploys contracts to the Ropsten testnet. Requires INFURA_KEY to be set as an environment variable. ```shell npx hardhat deploy --network ropsten ``` -------------------------------- ### Get EToken Balance Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/IEulerSimpleLens.sol/contract.IEulerSimpleLens.md Retrieves the EToken balance for a given underlying asset and account. Use this to query the amount of ETokens held by a specific address. ```solidity function getETokenBalance(address underlying, address account) external view returns (uint256); ``` -------------------------------- ### Get DToken Balance Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/IEulerSimpleLens.sol/contract.IEulerSimpleLens.md Retrieves the DToken balance for a given underlying asset and account. Use this to query the amount of DTokens held by a specific address. ```solidity function getDTokenBalance(address underlying, address account) external view returns (uint256); ``` -------------------------------- ### Execute Exact-In Flash Swap Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/FlashSwap.sol/contract.FlashSwap.md Executes a flash swap where the exact amount of input token is specified. Returns the amount of token bought. ```Solidity function _exactInFlashSwap( address _tokenIn, address _tokenOut, uint24 _fee, uint256 _amountIn, uint256 _amountOutMinimum, uint8 _callSource, bytes memory _data ) internal returns (uint256); ``` -------------------------------- ### Controller Constructor Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/Controller.md Initializes the Controller contract with necessary addresses for oracles, tokens, pools, and managers. ```APIDOC ## constructor /opynfinance/squeeth-monorepo/contracts/Controller.sol ### Description Initializes the Controller contract with necessary addresses for oracles, tokens, pools, and managers. ### Method CONSTRUCTOR ### Parameters: #### Path Parameters - **_oracle** (address) - Required - oracle address - **_shortPowerPerp** (address) - Required - ERC721 token address representing the short position - **_wPowerPerp** (address) - Required - ERC20 token address representing the long position - **_weth** (address) - Required - weth address - **_quoteCurrency** (address) - Required - quoteCurrency address - **_ethQuoteCurrencyPool** (address) - Required - uniswap v3 pool for weth / quoteCurrency - **_wPowerPerpPool** (address) - Required - uniswap v3 pool for wPowerPerp / weth - **_uniPositionManager** (address) - Required - uniswap v3 position manager address ``` -------------------------------- ### Constructor Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/FlashSwap.sol/contract.FlashSwap.md Details the constructor function for initializing the FlashSwap contract. ```APIDOC ## constructor *constructor* ```solidity constructor(address _factory); ``` ### Parameters |Name|Type|Description| |----|----|-----------| |`_factory`|`address`|uniswap factory address| ``` -------------------------------- ### Get Expected Normalization Factor (TypeScript) Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Accesses the normalization factor via an atom. This value is automatically tracked through hooks. Used for calculating actual debt. ```typescript // TypeScript - Norm factor is automatically tracked via hooks // Access via atom: normFactorAtom const normFactor = useAtomValue(normFactorAtom); const actualDebt = shortAmount.multipliedBy(normFactor); ``` -------------------------------- ### MockWPowerPerp Mint Function Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/mocks/MockWPowerPerp.md Allows minting of WPowerPerp tokens to a specified account. ```APIDOC ## POST /mockwpowerperp/mint ### Description Mints a specified amount of WPowerPerp tokens to a given account. ### Method POST ### Endpoint /mockwpowerperp/mint ### Parameters #### Request Body - **_account** (address) - Required - The address to mint tokens to. - **_amount** (uint256) - Required - The amount of tokens to mint. ``` -------------------------------- ### POST /closeShort Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Close a short position by buying back oSQTH on Uniswap and burning it to withdraw collateral. ```APIDOC ## POST /closeShort ### Description Close a short position by buying back oSQTH on Uniswap and burning it to withdraw collateral. ### Method POST ### Parameters #### Request Body - **_vaultId** (uint256) - Required - The vault ID to close - **_wPowerPerpAmount** (uint256) - Required - oSQTH to buy and burn - **_withdrawAmount** (uint256) - Required - ETH to withdraw - **_exactOutputParams** (ISwapRouter.ExactOutputSingleParams) - Required - Swap parameters ``` -------------------------------- ### Get ZenBull Token Price Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Internal view function to retrieve the current price of the ZenBull token using Uniswap's TWAP (Time-Weighted Average Price). ```solidity function _getZenBullPrice() internal view returns (uint256); ``` -------------------------------- ### Net ETH for ZenBull at Specific Price Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md Executes a swap of ETH for ZenBull tokens at a specified price and quantity. This function is external. ```solidity function netAtPrice(uint256 _price, uint256 _quantity) external; ``` -------------------------------- ### Get Withdraw Receipt by Index Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md External view function to retrieve details of a specific ZenBull withdrawal receipt using its index. Requires the withdrawal index as a parameter. ```solidity function getWithdrawReceipt(uint256 _index) external view returns (address, uint256, uint256); ``` -------------------------------- ### Get Deposit Receipt by Index Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md External view function to retrieve details of a specific ETH deposit receipt using its index. Requires the deposit index as a parameter. ```solidity function getDepositReceipt(uint256 _index) external view returns (address, uint256, uint256); ``` -------------------------------- ### Deploy Squeeth Contracts Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/README.md Deploys the Squeeth smart contracts using Hardhat. Ensure the Hardhat chain is running in a separate terminal. ```bash cd packages/hardhat yarn deploy ``` -------------------------------- ### Deploy Contracts Locally Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/README.md Deploys contracts to the local Hardhat chain. Ensure 'yarn chain' is running first. ```shell yarn deploy ``` -------------------------------- ### Get Sum of Queued ETH Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/ZenBullNetting.sol/contract.ZenBullNetting.md External view function to retrieve the total amount of ETH currently queued for deposit. This function does not modify state and can be called freely. ```solidity function depositsQueued() external view returns (uint256); ``` -------------------------------- ### Get Expected Normalization Factor (Solidity) Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Retrieves the normalization factor after funding is applied. This factor adjusts the effective debt amount. Used to calculate actual debt. ```solidity // Solidity - Get normalization factor function getExpectedNormalizationFactor() external view returns (uint256); ``` ```solidity // Example: Calculate actual debt uint256 normFactor = controller.getExpectedNormalizationFactor(); uint256 actualDebt = shortAmount * normFactor / 1e18; ``` -------------------------------- ### StrategyFlashSwap Constructor Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/strategy/base/StrategyFlashSwap.md Initializes the StrategyFlashSwap contract with a given Uniswap factory address. ```APIDOC ## constructor constructor ### Description Initializes the StrategyFlashSwap contract. ### Method CONSTRUCTOR ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example (Constructor calls do not have a request body in this format) ### Response #### Success Response (200) (Constructor calls do not typically return a response in this format) #### Response Example (Constructor calls do not have a response example in this format) ``` -------------------------------- ### Constructor Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/test/ControllerTester.md Initializes the ControllerTester contract. ```APIDOC ## constructor(address _controller) ### Description Initializes the ControllerTester contract with the address of the controller. ### Parameters #### Path Parameters - `_controller` (address) - Required - The address of the controller contract. ``` -------------------------------- ### Get Wsqueeth Amount - ICrabStrategyV2 Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/interface/ICrabStrategyV2.sol/contract.ICrabStrategyV2.md Calculates the equivalent amount of Wsqueeth based on a given amount of crab tokens. Useful for understanding token conversions within the strategy. ```solidity function getWsqueethFromCrabAmount(uint256 _crabAmount) external view returns (uint256); ``` -------------------------------- ### Get Pool Key Function Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/FlashSwap.sol/contract.PoolAddress.md Generates a PoolKey struct from two token addresses and a fee level. The tokens are ordered internally to ensure consistent pool identification. ```solidity function getPoolKey(address tokenA, address tokenB, uint24 fee) internal pure returns (PoolKey memory); ``` -------------------------------- ### Mint oSQTH and LP into Uniswap (Solidity) Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt This function allows minting oSQTH and providing liquidity to the oSQTH/ETH Uniswap V3 pool in one transaction. The `collateralToLp` parameter specifies the ETH amount to be used for liquidity provision. ```Solidity struct MintAndLpParams { address recipient; address wPowerPerpPool; uint256 vaultId; uint256 wPowerPerpAmount; uint256 collateralToDeposit; uint256 collateralToLp; uint256 amount0Min; uint256 amount1Min; int24 lowerTick; int24 upperTick; } function wMintLp(MintAndLpParams calldata _params) external payable; ``` ```Solidity // Example: Mint 1 oSQTH and LP with 2 ETH ControllerHelper.MintAndLpParams memory params = ControllerHelper.MintAndLpParams({ recipient: msg.sender, wPowerPerpPool: squeethPool, vaultId: 0, // new vault wPowerPerpAmount: 1e18, // mint 1 oSQTH collateralToDeposit: 3 ether, // vault collateral collateralToLp: 2 ether, // ETH for LP amount0Min: 0, amount1Min: 0, lowerTick: -887220, upperTick: 887220 }); controllerHelper.wMintLp{value: 5 ether}(params); ``` -------------------------------- ### Get Time-Weighted Average Tick (Solidity) Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Retrieves the time-weighted average tick for a specified Uniswap V3 pool. This value is useful for price calculations and does not require decimal conversion. ```solidity // Solidity - Get average tick function getTimeWeightedAverageTickSafe( address _pool, uint32 _period ) external view returns (int24 timeWeightedAverageTick); ``` ```solidity // Example: Get average tick for oSQTH pool int24 avgTick = oracle.getTimeWeightedAverageTickSafe( wPowerPerpPool, 420 ); ``` -------------------------------- ### liquidate Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/core/Controller.md Liquidate an under-collateralized vault by burning wPowerPerp. ```APIDOC ## liquidate ### Description If a vault is under the 150% collateral ratio, anyone can liquidate the vault by burning wPowerPerp. Liquidator can get back (wPowerPerp burned) * (index price) * (normalizationFactor) * 110% in collateral. ### Parameters - **_vaultId** (uint256) - Required - vault to liquidate - **_maxDebtAmount** (uint256) - Required - max amount of wPowerPerpetual to repay ### Response - **Return Value** (uint256) - amount of wPowerPerp repaid ``` -------------------------------- ### MockErc20 Constructor Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/hardhat/docs/contracts-documentation/mocks/MockErc20.md Initializes the MockErc20 contract with a name, symbol, and decimals. ```APIDOC ## MockErc20 Constructor ### Description Initializes the MockErc20 contract with a name, symbol, and decimals. ### Method CONSTRUCTOR ### Parameters #### Path Parameters - **_name** (string) - Required - The name of the token. - **_symbol** (string) - Required - The symbol of the token. - **_decimals** (uint8) - Required - The number of decimals for the token. ``` -------------------------------- ### Oracle API - Get TWAP Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Fetches the Time-Weighted Average Price (TWAP) from Uniswap V3 pools, converted to 18 decimal precision. Used for collateralization checks and funding calculations. ```APIDOC ## GET /oracle/getTwap ### Description Fetch TWAP price from Uniswap V3 pools, converted to 18 decimal precision. Used for collateralization checks and funding calculations. ### Method GET ### Endpoint /oracle/getTwap ### Parameters #### Path Parameters None #### Query Parameters - **_pool** (address) - Required - The address of the Uniswap V3 pool. - **_base** (address) - Required - The base token address (numerator). - **_quote** (address) - Required - The quote token address (denominator). - **_period** (uint32) - Required - The TWAP period in seconds. - **_checkPeriod** (bool) - Optional - If true, caps the period to the maximum available. ### Request Example ```bash curl -X GET "/oracle/getTwap?_pool=0x...&_base=0x...&_quote=0x...&_period=420&_checkPeriod=true" ``` ### Response #### Success Response (200) - **twapPrice** (uint256) - The TWAP price, scaled by 1e18. #### Response Example ```json { "twapPrice": "3000000000000000000" } ``` ``` -------------------------------- ### Get TWAP (TypeScript) Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt TypeScript hook to safely retrieve the Time-Weighted Average Price (TWAP) from a Uniswap V3 pool. Handles potential errors and provides the price in a usable format. ```typescript // TypeScript - Using Oracle hook const { getTwapSafe } = useOracle(); const ethPrice = await getTwapSafe( ethUsdcPool, weth, usdc, 420 // TWAP period ); ``` -------------------------------- ### calcOsqthToMintAndEthIntoCrab Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/NettingLib.sol/contract.NettingLib.md Calculates oSQTH to mint and ETH to deposit into Crab v2. ```APIDOC ## calcOsqthToMintAndEthIntoCrab ### Description Calculate oSQTH to mint and amount of eth to deposit into Crab v2 based on amount of crab token. ### Parameters - **_crab** (address) - crab strategy address - **_zenBull** (address) - ZenBull strategy address - **_crabAmount** (uint256) - amount of crab token ``` -------------------------------- ### Get TWAP (Solidity) Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Fetches the Time-Weighted Average Price (TWAP) from a Uniswap V3 pool. The price is converted to 18 decimal precision and is used for collateralization checks and funding calculations. ```solidity // Solidity - Get TWAP function getTwap( address _pool, // Uniswap V3 pool address address _base, // base token (numerator) address _quote, // quote token (denominator) uint32 _period, // TWAP period in seconds bool _checkPeriod // if true, caps period to max available ) external view returns (uint256); ``` ```solidity // Example: Get ETH/USDC price with 420 second TWAP uint256 ethPrice = oracle.getTwap( ethUsdcPool, weth, usdc, 420, true ); // Returns price scaled by 1e18, e.g., 3000e18 = $3000 ``` -------------------------------- ### Simple ETH Deposit (Solidity) Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Deposits ETH directly into the Crab strategy. The strategy mints and returns oSQTH to the depositor, who is responsible for selling it separately. ```solidity // Solidity - Simple deposit function deposit() external payable; ``` ```solidity // Example: Deposit 1 ETH crabStrategyV2.deposit{value: 1 ether}(); ``` -------------------------------- ### Get ZenBull Token Price Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/NettingLib.sol/contract.NettingLib.md Retrieves the price of the ZenBull token. Requires addresses for ZenBull, EulerLens, USDC, WETH, and the fair price of Crab token in ETH, along with the ETH/USDC price. ```solidity function getZenBullPrice( address _zenBull, address _eulerLens, address _usdc, address _weth, uint256 _crabFairPriceInEth, uint256 _ethUsdcPrice ) external view returns (uint256); ``` -------------------------------- ### mintWPowerPerpAmount - Mint oSQTH Tokens Source: https://context7.com/opynfinance/squeeth-monorepo/llms.txt Deposit ETH collateral and mint a specified amount of wPowerPerp (oSQTH) tokens. Creates a new vault if vaultId is 0, or adds to an existing vault. ```APIDOC ## POST /api/mintWPowerPerpAmount ### Description Deposit ETH collateral and mint a specified amount of wPowerPerp (oSQTH) tokens. Creates a new vault if vaultId is 0, or adds to an existing vault. ### Method POST ### Endpoint /api/mintWPowerPerpAmount ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **_vaultId** (uint256) - Required - 0 to create new vault - **_wPowerPerpAmount** (uint256) - Required - amount of wPowerPerp to mint - **_uniTokenId** (uint256) - Optional - optional Uniswap LP NFT as additional collateral ### Request Example ```json { "_vaultId": 0, "_wPowerPerpAmount": "1000000000000000000", "_uniTokenId": 0 } ``` ### Response #### Success Response (200) - **vaultId** (uint256) - The ID of the created or updated vault. #### Response Example ```json { "vaultId": "1" } ``` ``` -------------------------------- ### Get Uniswap V3 Pool Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/zen-bull-netting/docs/src/src/FlashSwap.sol/contract.FlashSwap.md Internal view function to retrieve the Uniswap V3 pool address for a given pair of tokens and fee tier. The pool contract may or may not exist. ```Solidity function _getPool(address tokenA, address tokenB, uint24 fee) internal view returns (IUniswapV3Pool); ``` -------------------------------- ### Set Cypress Base URL for Uniswap LP Page Source: https://github.com/opynfinance/squeeth-monorepo/blob/main/packages/frontend/cypress/TEST.md Configure the `baseUrl` in `cypress.json` to point to the Uniswap LP page for testing liquidity provision. ```json "baseUrl": "https://squeeth-uniswap.netlify.app/#/add/ETH/0xa4222f78d23593e82Aa74742d25D06720DCa4ab7/3000" ```