Skip to content

Commit

Permalink
Crab netting contract - Lets approve and merge (#686)
Browse files Browse the repository at this point in the history
* added crab netting forge packge

* deposit for crab netting

* Added deposit and withdraw crab in netting

* renamed var name with underscore amount

* First version of crab netting

* added functions to view deposits and withdraws remaining

* Temp commit for koushik to take a peek

* adding the binary search to find the flashDep amount

* added withdraw index to update receipts of withdrawn amount

* renamed deposit crab to queueCrabForWithdrawal

* first version of withdraw auction code

* fixed failing tests

* removed sqth as immutable

* Fix: USDC is now 6 decimals

* Renamed variables to camel case

* added onlyowner modifier and removed some todos

* added test to catch the delete memory bug

* gitignored lcov.info

* removed sending out eth on deposit

* Fix: Large withdraws usdc and crab

* fixed for loop i turns negative error

* cleaned up usdc deposit and withdraw tests

* refactored test for Queued Balances

* refacotored netting tests

* refactor fork test for netting

* refactored depositAuction Test

* withdraw auction test refactored

* deposit auction params introduced with fee

* added signature checks

* added ability to pause withdraws after auction start

* added natspec and events for deposit withdraw and netting; auctions left

* testless partial auction fill

* added test for eth going up and selling lesser sqth

* changes after walkthrough with andrew

* added to_send.eth flashDeposit fix

* added comments

* added events to deposit and withdraw auction

* added test to check balance of withdrawer

* added checks for clearing Price

* while withdrawing only send eth from withdraw

* added sending back the remaining eth amount from the deposit tx

* fixed all failing tests

* added price checks

* added test when mm order amount is very less too

* added multiple orders in tests

* in deposit auction price can be equal to clearing

* added fee adjustment

* removed todos

* added tests for require in deposits

* add tests for some reverts

* review fixes first set; onlyOwner + constructor courtesy km

* clearing price is now favourable for mm

* added cumulative balance check for crab withdrawal

* tests now have correct flashDeposit

* event parameter was wrong in net at price; kaushik

* added require statements

* reduced init balance when converting eth to usdc

* immutables; indexed; storage to memory

* added weth and eth balance reduction to withdraw

* sqthTWAP; flashDeposit only when > eth balance

* First set of fixes from andrew review notion page

* refunds are now in weth

* renamed to dequeue crab

* rounded down portions

* ran forge formatter
  • Loading branch information
sanandnarayan authored Nov 14, 2022
1 parent 5f0b777 commit d004aef
Show file tree
Hide file tree
Showing 21 changed files with 2,094 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ packages/crab-netting/cache


soljson*
lcov.info
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@
[submodule "packages/crab-netting/lib/openzeppelin-contracts"]
path = packages/crab-netting/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "packages/crab-netting/lib/v3-periphery"]
path = packages/crab-netting/lib/v3-periphery
url = https://github.com/uniswap/v3-periphery
[submodule "packages/crab-netting/lib/v3-core"]
path = packages/crab-netting/lib/v3-core
url = https://github.com/uniswap/v3-core
1 change: 1 addition & 0 deletions packages/crab-netting/lib/v3-core
Submodule v3-core added at 412d9b
1 change: 1 addition & 0 deletions packages/crab-netting/lib/v3-periphery
Submodule v3-periphery added at b06959
4 changes: 3 additions & 1 deletion packages/crab-netting/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
squeeth-monorepo/=lib/squeeth-monorepo/packages/hardhat/contracts/
openzeppelin/=lib/openzeppelin-contracts/contracts/
openzeppelin/=lib/openzeppelin-contracts/contracts/
@uniswap/v3-periphery/=lib/v3-periphery/
@uniswap/v3-core/=lib/v3-core/
Loading

1 comment on commit d004aef

@vercel
Copy link

@vercel vercel bot commented on d004aef Nov 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.