GithubHelp home page GithubHelp logo

v3-core-optimism's Introduction

Uniswap V3 Optimism

Lint Tests npm version

This repository contains the core smart contracts for the Uniswap V3 Protocol forked for Optimism. For higher level contracts, see the uniswap-v3-periphery-optimism repository.

Licensing

The primary license for Uniswap V3 Core is the Business Source License 1.1 (BUSL-1.1), see LICENSE.

Exceptions

  • All files in contracts/interfaces/ are licensed under GPL-2.0-or-later (as indicated in their SPDX headers), see contracts/interfaces/LICENSE
  • Several files in contracts/libraries/ are licensed under GPL-2.0-or-later (as indicated in their SPDX headers), see contracts/libraries/LICENSE_GPL
  • contracts/libraries/FullMath.sol is licensed under MIT (as indicated in its SPDX header), see contracts/libraries/LICENSE_MIT
  • All files in contracts/test remain unlicensed.

v3-core-optimism's People

Contributors

danrobinson avatar gakonst avatar haydenadams avatar k06a avatar lint-action avatar moodysalem avatar noahzinsmeister avatar rmi7 avatar snreynolds avatar yorkemartin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

v3-core-optimism's Issues

when fee is zeor, provide liquidity is not good. Or the fee is too small

Alice have 2 X, 2 Y
Bob have 2 X, 2 Y
Alice Provide liquidity, Bob does not
K=4 x=2, y=2
(1, 4), (2, 2), (4, 1)
X-based assets
fee is zeor

when (2,2) Alice asset 4, Bob asset 4
when (1,4) Alice asset 2, Bob asset 2+21/4=2.5
when (4,1) Alice asset 8, Bob asset 2+2
4/1=10
so Bob asset >= Alice asset

prove:
(x1, y1) change (x2, y2)
Alice asset is 2 * x2
Bob asset is x1+y1 * x2/y2=x1+(K/x1) * x2/y2=x1+(K/x1) * (x2 * x2)/(x2 * y2)=x1+(K/x1) * (x2 * x2)/K=x1+x2 * x2/x1
x1+x2 * x2/x1 - 2 * x2=(x1 * x1+x2 * x2-2 *x1 * x2)/x1=(x1-x2) * (x1-x2)/x1 >= 0

Run the Oracle maxed out observations array test once

We skip this normally on L1, and only run it manually to verify changes to the oracle library, because it takes a long time to set up the fixture

Because L2 geth does not have test snapshotting features, this group of tests is expected to take prohibitively long to run, so we are not sure if observe will work with maxed out observations arrays (i.e. 65535 observations)

https://github.com/Uniswap/uniswap-v3-core-optimism/blob/7f33d8d69f5fb28c34fdff265411bb6f2ab860a5/test/Oracle.spec.ts#L641-L801

investigate `#snapshotCumulativesInside` test failures

the #snapshotCumulativesInside tests typically fail in CI, when run locally with .only, they typically succeed but with 100x the gas usage of the EVM version.

  3) UniswapV3Pool gas tests
       fee is off
         #snapshotCumulativesInside
           tick above:
     Error: transaction failed (transactionHash="0xc0101c12a0f5481fad60ec9f9055aa4e133cbfc58db98d737f48a5201bd49c3f", transaction={"nonce":4079,"gasPrice":{"type":"BigNumber","hex":"0x00"},"gasLimit":{"type":"BigNumber","hex":"0x68b0bb"},"to":"0x637DCa678569cEf6312CA1d5E2c9b420be7F6d63","value":{"type":"BigNumber","hex":"0x00"},"data":"0x9e77b8050000000000000000000000008f2f4cdf79ca76fd90438b500b15736759b56d58000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d25000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266","chainId":420,"v":875,"r":"0xc2e0a91192b2df7c5cd081e14a3b1cdd77d66548403ec3b4fa13664799d89107","s":"0x050fe19e64a9bcfad4e3b9e7e146c18df2831e7530a8fa0e37cf027e38fa615f","from":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","hash":"0xc0101c12a0f5481fad60ec9f9055aa4e133cbfc58db98d737f48a5201bd49c3f"}, receipt={"to":"0x637DCa678569cEf6312CA1d5E2c9b420be7F6d63","from":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","contractAddress":null,"transactionIndex":0,"gasUsed":{"type":"BigNumber","hex":"0x939190"},"logsBloom":"0x00000000000000000000000000000000000000000000000000040000000000000000000000000000000000100000000100000000000000000000000000000000000000000000000000000008000000000000000000000000000000400000000000000000000000000000000100000000000000000000000000000010000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000200000000000000000000000002000000000000000000000000000000000000008000000000000000000000000000000000000000000000000","blockHash":"0x4f054748cda348c9a891df68de0d8554ecd34e459b8ec2a26c392b3929378ea9","transactionHash":"0xc0101c12a0f5481fad60ec9f9055aa4e133cbfc58db98d737f48a5201bd49c3f","logs":[{"transactionIndex":0,"blockNumber":4100,"transactionHash":"0xc0101c12a0f5481fad60ec9f9055aa4e133cbfc58db98d737f48a5201bd49c3f","address":"0x4200000000000000000000000000000000000006","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266","0x0000000000000000000000004200000000000000000000000000000000000011"],"data":"0x0000000000000000000000000000000000000000000000000000000000000000","logIndex":0,"blockHash":"0x4f054748cda348c9a891df68de0d8554ecd34e459b8ec2a26c392b3929378ea9"}],"blockNumber":4100,"confirmations":1,"cumulativeGasUsed":{"type":"BigNumber","hex":"0x939190"},"status":0,"byzantium":true}, code=CALL_EXCEPTION, version=providers/5.0.17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.