Squeeth is a new financial primitive in DeFi that gives traders exposure to ETH²

Overview

Squeeth Monorepo

The Squeethiest 🐱

Discord Twitter Follow

🤔 What is Squeeth

The squeeth contract is designed for users to long or short a special index: Eth², as an implementation of a Power Perpetual.

This monorepo contains the source code for the frontend app as well as the contracts, you can spin up the environment locally, run tests, or play around with the code. For more details about how to use the contracts and frontend, go to packages/ and choose hardhat for the contracts or frontend, we have more detailed explanation in each sub-folder.

📚 Learn more

🔒 Security And Bug Bounty Program

Security is our one of our highest priorities. Our team has created a protocol that we believe is safe and dependable, and is audited by Trail of Bits and Akira, and is insured by Sherlock. All smart contract code is publicly verifiable and we have a bug bounty for undiscovered vulnerabilities. We encourage our users to be mindful of risk and only use funds they can afford to lose. Smart contracts are still new and experimental technology. We want to remind our users to be optimistic about innovation while remaining cautious about where they put their money.

Please see here for details on our security audit and bug bounty program.

🏄‍♂️ Quick Start

Prerequisites: Node plus Yarn.

install and start your 👷‍ Hardhat chain:

cd packages/hardhat
yarn install
yarn chain

in a second terminal window, start your 📱 frontend:

cd packages/frontend
yarn install
yarn dev

in a third terminal window, 🛰 deploy your contract:

cd packages/hardhat
yarn deploy

Open http://localhost:3000 to see the app

Comments
  • fix: reduce number of calls made to infura/alchemy

    fix: reduce number of calls made to infura/alchemy

    Task:

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

    Description

    Looks like calling useController() in many different places is causing repeat API calls to Infura/Alchemy. This PR attempts to reduce the number of API calls by reducing the number of useController() calls.

    Ideally this alone would fix issue 11, but it alone cannot. I think there are two places where the API calls really skyrocket from useController() - inside packages/frontend/src/hooks/usePositions.ts there are two function usePositions and useShortPositions. Replacing the const { getDebtAmount } = useController() with a dummy method reduces a lot of API calls, which leads me to suspect that if the getDebtAmount method could be extracted out from useController(), a lot of API calls could be removed.

    Fixes # (issue) https://github.com/opynfinance/squeeth-monorepo/issues/11

    Type of change

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    Start the frontend for main branch and record the number of Infura/Alchemy API calls.

    Start the frontend for issue-11 branch and open the networks tab to compare the new number of Infura/Alchemy API calls. There should be fewer API calls.

    Please reproduce on your end as this is my first PR for the Squeeth FE and I am not so familiar with the codebase. Thanks!

    Checklist

    • [ ] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] My changes generate no new warnings
    • [ ] Added video recordings if it is a UI change
    opened by ezhou7 15
  • Add collateral you redeem

    Add collateral you redeem

    Task:

    This PR involves refactoring the existing logic of ShortClose so needs a detailed review.

    Description

    Add collateral Eth input and refactored dependency logic image

    Fixes https://github.com/opynfinance/squeeth-monorepo/issues/370

    Type of change

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    Please describe how to test to verify the changes. Provide instructions so we can reproduce.

    Checklist

    • [ ] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] My changes generate no new warnings
    • [ ] Added video recordings if it is a UI change
    frontend 
    opened by adam5909099 11
  • Fix unstable/inflated unrealised pnl issues

    Fix unstable/inflated unrealised pnl issues

    Task:

    Description

    • Replaces vault manager subscription with polling to ensure that vault data is always updated.
    • Replaces swaps data with swaps atom in computeSwaps provider to ensure that squeethAmount is always updated for pnl calculation.
    • Removes swaps query subscription as it didn't seem to work and was causing bug of swaps being empty array sometimes.
    • Adds unit tests for unrealized pnl calculations. Run test with: yarn test pnl

    Fixes # (issue) #350

    Type of change

    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    You can test by seeing if you experience loading issues or incorrect pnl. see this doc for the unrealized pnl formulas.

    Checklist

    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] My changes generate no new warnings
    • [ ] Added video recordings if it is a UI change
    frontend 
    opened by EstherSeyi 11
  • Update ControllerHelper pools to take a pool input from f/e to allow multi pool routing in future (pool, fee, etc)

    Update ControllerHelper pools to take a pool input from f/e to allow multi pool routing in future (pool, fee, etc)

    If there is ever liquidity in different fee tier pools, this contract can not support trading other than the 0.3% pool, maybe should be included, or could be added / changed in future.

    controller helper 
    opened by aleone 10
  • feat: add embed image for twitter preview

    feat: add embed image for twitter preview

    Task:

    Description

    Add embed image to head section of page to enable preview when squeeth is shared in twitter.

    A URL to a unique image representing the content of the page. You should not use a generic image such as your website logo, author photo, or other image that spans multiple pages. Images for this Card support an aspect ratio of 2:1 with minimum dimensions of 300x157 or maximum of 4096x4096 pixels. Images must be less than 5MB in size. JPG, PNG, WEBP and GIF formats are supported. Only the first frame of an animated GIF will be used. SVG is not supported.

    Fixes #218 (issue)

    Type of change

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    Please describe how to test to verify the changes. Provide instructions so we can reproduce.

    Checklist

    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] My changes generate no new warnings
    • [ ] Added video recordings if it is a UI change
    frontend 
    opened by rootial 10
  • Fix old tests issues due to using gasPrice(0)

    Fix old tests issues due to using gasPrice(0)

    Task:

    Fix old tests issues due to using gasPrice(0)

    Description

    • Added txCost from the transaction
    • Include txCost in the expression to check liquidator balance

    Fixes # (issue)

    Type of change

    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    Please describe how to test to verify the changes. Provide instructions so we can reproduce.

    Checklist

    • [x] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] My changes generate no new warnings
    • [ ] Added video recordings if it is a UI change
    opened by block902 9
  • Unrealized PnL for partially closed positions is off

    Unrealized PnL for partially closed positions is off

    Task:

    Description

    This PR

    • updates short unrealized pnl calculations to account for a partially closed position.
    • adds new long unrealized pnl calculation that will account for a partially closed position
    • updates long unrealized pnl in position card and page

    Fixes # (issue) #42

    Type of change

    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    This PR can be tested by:

    • Checking the calculations on the code to ensure that it's correct

    Checklist

    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] My changes generate no new warnings
    • [ ] Added video recordings if it is a UI change
    opened by EstherSeyi 9
  • Goerli Deployment

    Goerli Deployment

    Task: Goerli deployment

    Description

    This PR deploy all Squeeth contract other than the CrabMigration to Goerli, add addresses to the frontend package and deploy subgraph.

    Type of change

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    Please describe how to test to verify the changes. Provide instructions so we can reproduce.

    FE Checklist

    • [ ] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] My changes generate no new warnings
    • [ ] Added video recordings if it is a UI change

    User Facing Checklist

    • [ ] I fully understand the user problem this PR is solving
    • [ ] I know who the target user is for this PR and have a deep understanding of that user
    • [ ] I have tried this flow thinking from the pov of the target user for this PR
    • [ ] I (or working w someone on team) have scheduled a user test for this PR (if it is a large change)
    opened by daryakaviani 8
  • Add transfer vault capability for crab v2

    Add transfer vault capability for crab v2

    Task:

    Add vault transferring capability to crabV2

    I am getting Contract code size exceeds 24576 bytes so I disabled it for now and we have to fix it later

    Description

    • [x] Add transferVault event
    • [X] Set Cap to 0
    • [X] Add tests for transfer vault
    • [X] Add time lock contract
    • [x] Add tests for timelock
    Crab v2 
    opened by KMKoushik 8
  • Add UI for your vaults

    Add UI for your vaults

    Task:

    https://github.com/opynfinance/squeeth-monorepo/issues/186 image

    Description

    Add your vaults section which shows list of user's vaults whose collateral amount is greater than 0

    Fixes # (issue)

    Type of change

    • [x] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    Go to positions and check if clicking vault in your vaults section redirect to vault detail.

    Checklist

    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] My changes generate no new warnings
    • [ ] Added video recordings if it is a UI change
    frontend 
    opened by adam5909099 8
  • Refactor: move position hooks to context

    Refactor: move position hooks to context

    Task: move position hooks to context

    Description

    This PR moves position hook to context

    Fixes # (issue) #75

    Type of change

    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    Please describe how to test to verify the changes. Provide instructions so we can reproduce.

    Checklist

    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] My changes generate no new warnings
    • [ ] Added video recordings if it is a UI change
    opened by EstherSeyi 8
  • change some diff

    change some diff

    Task:

    Description

    Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

    Fixes (linear-task)

    Type of change

    • [ ] New feature
    • [ ] Bug fix
    • [ ] Testing code
    • [ ] Document update or config files
    opened by sanandnarayan 1
  • Updated crabnetting address

    Updated crabnetting address

    Task:

    Description

    Update crab netting address to use updated crab and swaprouter for goerli.

    Type of change

    • [ ] New feature
    • [ ] Bug fix
    • [ ] Testing code
    • [ ] Document update or config files
    opened by DemolaJames 1
  • CrabNetting goerli deploy script

    CrabNetting goerli deploy script

    Task:

    Description

    Added script to help with deployment for crabnetting.

    Type of change

    • [ ] New feature
    • [ ] Bug fix
    • [ ] Testing code
    • [ ] Document update or config files
    opened by DemolaJames 1
  • UI: LP page redesign

    UI: LP page redesign

    Task:

    LP page redesign

    Description

    Affects:

    • /lp page
    • /mint page

    more details in the loom below: https://www.loom.com/share/2b50bab72f724c4ea217b7dea22eff82

    Type of change

    • [ ] New feature
    • [ ] Bug fix
    • [ ] Testing code
    • [ ] Document update or config files
    • [x] UI improvement
    opened by iamoperand 1
  • Frontend for Opening a New Position with 1-Click-LP

    Frontend for Opening a New Position with 1-Click-LP

    Task:

    Frontend for Opening a New Position for Mint + LP. New LP page is at /new-lp slug

    Description

    This is the 1st part of 1-Click-LP project, which basically builds on top of ControllerHelper smart contract.

    Loom video

    The frontend lets the user input ETH amount. This amount then gets split out into ethInVault and ethInLP.

    Type of change

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] Document update

    How Has This Been Tested

    Couldn't test it on any network, neitherlocal nor Goerli, since ControllerHelper contract isn't ready to be deployed there. @DemolaJames is currently working on deploying it on Goerli.

    So no other way but to compare it with the reference implementation in this PR. Compared the ETH deposit values and everything seems fine.

    FE Checklist

    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] My changes generate no new warnings
    • [x] Added video recordings if it is a UI change

    User Facing Checklist

    • [x] I fully understand the user problem this PR is solving
    • [x] I know who the target user is for this PR and have a deep understanding of that user
    • [x] I have tried this flow thinking from the pov of the target user for this PR
    • [ ] I (or working w someone on team) have scheduled a user test for this PR (if it is a large change)
    opened by iamoperand 2
Releases(v1.0)
Converts your GitHub commits to LinkedIn posts, to maximize exposure.

linkedpush (site) Converts your GitHub pushes to LinkedIn posts, to maximize exposure. linkedpush-dep-tictok.mp4 How it works Sequence diagram Setup 0

Sebastian Sosa 8 Dec 3, 2022
Simple Solid primitive unit test utility.

solid-primitive-test-util Simple Solid primitive unit test utility. Install pnpm add solid-primitive-test-util -D Example Basic Usage Let's say we hav

Robert Soriano 2 Mar 21, 2022
🧩 TypeScript utility type in order to ensure to return only properties (not methods) containing values in primitive types such as number or boolean (not Value Objects)

?? TypeScript Primitives type TypeScript utility type in order to ensure to return only properties (not methods) containing values in primitive types

CodelyTV 82 Dec 7, 2022
An easy and simple way to manage your financial transactions.

MyWallet An easy and simple way to manage your financial transactions. With MyWallet you can track your incomes and expenses and always keep track of

Caroline Oliveira 7 Nov 16, 2022
This web application retrieves real live data from the Financial modeling prep API

This web application retrieves real live data from the Financial modeling prep API. It provides financial information about companies listed on Nasdaq 100 and Dow Jones Market indexes. All these companies are listed on the Home page. Users can filter these companies by searching for a specific company or by choosing one from the dropdown.

Sahar Abdel Samad 7 May 31, 2022
Marry in Web3, Mint Paired Soulbound NFTs by MultiSign Flow, No transfer, No sell, a non-financial Dapp

ERC721-520 Token 是 NFT-like Soulbound Token Standard(灵魂绑定凭证) 的一种实现,是 ERC721 标准的扩展。 ERC721-520 Token 不可转让,不可售卖,一个人同时只能有一个有效 Token ERC721-520 Token 由二者通

Marry3 48 Dec 21, 2022
Fastest way to get financial data from Plaid into your Postgres database. Go from zero to live in 5 minutes without a single line of code.

Venice Venice is a the fastest way to get financial data from Plaid into your Postgres database. Zero to production in 5 minutes without a single line

Venice 93 Dec 12, 2022
Components and tools for building DeFi dapps on Solana + Anchor. Public domain license.

Solana DeFi Framework Components and tools for building DeFi dapps on Solana + Anchor. Public domain license. Status Pre-pre-pre-alpha. Contributing A

null 4 Mar 28, 2022
Transaction tracker for Defi Kingdoms and more!

DFK Balances DFK Balances is a super customizable and extensible Financial tracker for the DeFi Kingdoms ecosystem. It allows users to easily add thei

Gabriel Guimaraes 9 Feb 22, 2022
A comprehensive collection of useful tools developed with the help of Ethers.js to interact with the Ethereum Blockchain to develop great DeFi apps as quickly and easily as possible.

hudi-packages-ethersfactory How to install Installing with npm For more information on using npm check out the docs here. npm i @humandataincome/ether

HUDI 6 Mar 30, 2022
This repo is dedicated to making minimal repos of existing defi primatives.

Defi Minimal This repo is dedicated to making minimal repos of existing defi primatives. WARNING: None of the contracts are audited! Completed (but un

SmartContract 302 Jan 7, 2023
🏦 Defi Bank is a dapp created for ethereum 101 course of cadena.dev

Welcome to DefiBank ?? Defi Bank is a dapp created for ethereum 101 course of cadena.dev ✨ Demo Install npm install Usage npm run dev Tech NextJS Reac

Alberto Cruz Luis 7 Nov 21, 2022
In this repository, I try to perform a mainnet fork and then simulate popular smart contract exploits on various DEFI Protocols using Hardhat Framework.

defiHacks_via_Hardhat 1. Alchemix Access Control Bug Any user could have called setWhitelist() to give an attacker the ability to call the harvest fun

null 34 Dec 27, 2022
Multi-chain defi crypto sniper written in typescript/javascript. Fastest method of sniping with auto-sell and rug prevention features.

CryptoSniper Community Edition Multi-chain defi crypto sniper written in typescript/javascript. Fastest method of sniping with auto-sell and rug preve

null 18 Nov 3, 2022
A Stacks DeFi app that automates covered call writing to generate sustainable, risk-adjusted yield.

?? Options Vault ?? A Stacks DeFi app that automates covered call writing to generate sustainable, risk-adjusted yield. Options vaults allow you to al

null 15 Nov 16, 2022
DevArms - a collection of developer utils that gives you extra arms to reach more in your tasks

DevArms is a collection of developer utils that gives you extra arms to reach more in your tasks. It runs completely offline, and cross-platform across Windows, Mac and Linux. Written in Rust, React. Powered by Tauri.

Qiushi Pan 82 Dec 18, 2022
Landscape Generator is An open Source web application that generates landscape drawings randomly, then gives you the ability to edit it and export it as SVG or PNG.

Landscape Generator ## About Landscape Generator is An open Source web application that generates landscape drawings randomly, then gives you the abil

null 9 Apr 15, 2022
This is an app that gives you a mood by looking at the weather.

Weather-to-mood It is a basic application which shows user weather and date and by looking at these information it gives a mood. WeatherMoodApp This p

Büşra Akbulut 4 Jun 30, 2022
TRAB is a Chrome extension that gives you a single button to mark tweet as spam, and block the tweet's creator

TRAB - Tweet Reporter and Blocker TRAB is a Chrome extension that gives you a single button to do two things with a single click: Mark a Tweet as spam

Amit Ruparel 16 May 4, 2022