Skip to content

Commit

Permalink
Contract licenses (Uniswap#205)
Browse files Browse the repository at this point in the history
* Contract licenses

* fix: update readme

---------

Co-authored-by: Mark Toda <[email protected]>
  • Loading branch information
hensha256 and marktoda authored Jun 12, 2023
1 parent 957b7ce commit 24f3b2e
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 39 deletions.
26 changes: 13 additions & 13 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ HooksTest:testValidateHookAddressBeforeDonate(uint152) (runs: 256, μ: 1804, ~:
HooksTest:testValidateHookAddressBeforeInitialize(uint152) (runs: 256, μ: 1829, ~: 1829)
HooksTest:testValidateHookAddressBeforeModify(uint152) (runs: 256, μ: 1855, ~: 1855)
HooksTest:testValidateHookAddressBeforeSwap(uint152) (runs: 256, μ: 1848, ~: 1848)
HooksTest:testValidateHookAddressFailsAllHooks(uint152,uint8) (runs: 256, μ: 4729, ~: 4676)
HooksTest:testValidateHookAddressFailsNoHooks(uint152,uint8) (runs: 256, μ: 4778, ~: 4742)
HooksTest:testValidateHookAddressFailsAllHooks(uint152,uint8) (runs: 256, μ: 4728, ~: 4676)
HooksTest:testValidateHookAddressFailsNoHooks(uint152,uint8) (runs: 256, μ: 4777, ~: 4719)
HooksTest:testValidateHookAddressNoHooks(uint152) (runs: 256, μ: 1837, ~: 1837)
OwnedTest:testConstructor(address) (runs: 256, μ: 159767, ~: 159767)
OwnedTest:testSetOwnerFromNonOwner(address,address) (runs: 256, μ: 160761, ~: 160925)
OwnedTest:testSetOwnerFromOwner(address,address) (runs: 256, μ: 162996, ~: 162996)
PoolManagerTest:testDonateFailsIfNoLiquidity(uint160) (runs: 256, μ: 104877, ~: 105037)
PoolManagerTest:testDonateFailsIfNoLiquidity(uint160) (runs: 256, μ: 104862, ~: 105036)
PoolManagerTest:testDonateFailsIfNotInitialized() (gas: 69323)
PoolManagerTest:testDonateFailsWithIncorrectSelectors() (gas: 1103240)
PoolManagerTest:testDonateSucceedsForNativeTokensWhenPoolHasLiquidity() (gas: 500356)
Expand All @@ -55,23 +55,23 @@ PoolManagerTest:testGasSwapWithNative() (gas: 196676)
PoolManagerTest:testLockEmitsCorrectId() (gas: 47981)
PoolManagerTest:testMintFailsIfNotInitialized() (gas: 70529)
PoolManagerTest:testMintFailsWithIncorrectSelectors() (gas: 872989)
PoolManagerTest:testMintSucceedsForNativeTokensIfInitialized(uint160) (runs: 256, μ: 260021, ~: 245169)
PoolManagerTest:testMintSucceedsIfInitialized(uint160) (runs: 256, μ: 263792, ~: 265288)
PoolManagerTest:testMintSucceedsForNativeTokensIfInitialized(uint160) (runs: 256, μ: 259906, ~: 245174)
PoolManagerTest:testMintSucceedsIfInitialized(uint160) (runs: 256, μ: 263809, ~: 265289)
PoolManagerTest:testMintSucceedsWithCorrectSelectors() (gas: 809654)
PoolManagerTest:testMintSucceedsWithHooksIfInitialized(uint160) (runs: 256, μ: 806670, ~: 808507)
PoolManagerTest:testMintSucceedsWithHooksIfInitialized(uint160) (runs: 256, μ: 806717, ~: 808507)
PoolManagerTest:testNoOpLockIsOk() (gas: 87210)
PoolManagerTest:testPoolManagerFeeControllerSet() (gas: 35330)
PoolManagerTest:testPoolManagerFetchFeeWhenController(uint160) (runs: 256, μ: 108227, ~: 108393)
PoolManagerTest:testPoolManagerInitialize((address,address,uint24,int24,address),uint160) (runs: 256, μ: 17884, ~: 13442)
PoolManagerTest:testPoolManagerFetchFeeWhenController(uint160) (runs: 256, μ: 108239, ~: 108394)
PoolManagerTest:testPoolManagerInitialize((address,address,uint24,int24,address),uint160) (runs: 256, μ: 17892, ~: 13442)
PoolManagerTest:testPoolManagerInitializeFailsIfTickSpaceNeg(uint160) (runs: 256, μ: 15323, ~: 15323)
PoolManagerTest:testPoolManagerInitializeFailsIfTickSpaceTooLarge(uint160) (runs: 256, μ: 16271, ~: 16271)
PoolManagerTest:testPoolManagerInitializeFailsIfTickSpaceZero(uint160) (runs: 256, μ: 15324, ~: 15324)
PoolManagerTest:testPoolManagerInitializeFailsWithIncorrectSelectors() (gas: 578101)
PoolManagerTest:testPoolManagerInitializeForNativeTokens(uint160) (runs: 256, μ: 57778, ~: 58111)
PoolManagerTest:testPoolManagerInitializeForNativeTokens(uint160) (runs: 256, μ: 57754, ~: 58111)
PoolManagerTest:testPoolManagerInitializeSucceedsWithCorrectSelectors() (gas: 578125)
PoolManagerTest:testPoolManagerInitializeSucceedsWithEmptyHooks(uint160) (runs: 256, μ: 543531, ~: 543687)
PoolManagerTest:testPoolManagerInitializeSucceedsWithHooks(uint160) (runs: 256, μ: 608207, ~: 608367)
PoolManagerTest:testPoolManagerInitializeSucceedsWithMaxTickSpacing(uint160) (runs: 256, μ: 49742, ~: 49893)
PoolManagerTest:testPoolManagerInitializeSucceedsWithEmptyHooks(uint160) (runs: 256, μ: 543512, ~: 543687)
PoolManagerTest:testPoolManagerInitializeSucceedsWithHooks(uint160) (runs: 256, μ: 608211, ~: 608373)
PoolManagerTest:testPoolManagerInitializeSucceedsWithMaxTickSpacing(uint160) (runs: 256, μ: 49741, ~: 49893)
PoolManagerTest:testSwapFailsIfNotInitialized(uint160) (runs: 256, μ: 72844, ~: 72844)
PoolManagerTest:testSwapFailsWithIncorrectSelectors() (gas: 948595)
PoolManagerTest:testSwapMintERC1155IfOutputNotTaken() (gas: 535548)
Expand All @@ -81,7 +81,7 @@ PoolManagerTest:testSwapSucceedsWithHooksIfInitialized() (gas: 649679)
PoolManagerTest:testSwapSucceedsWithNativeTokensIfInitialized() (gas: 105500)
PoolManagerTest:testSwapUse1155AsInput() (gas: 713157)
PoolTest:testModifyPosition(uint160,(address,int24,int24,int128,int24)) (runs: 256, μ: 20321, ~: 6980)
PoolTest:testPoolInitialize(uint160,uint8) (runs: 256, μ: 12619, ~: 5591)
PoolTest:testPoolInitialize(uint160,uint8) (runs: 256, μ: 12610, ~: 5591)
PoolTest:testSwap(uint160,(uint24,int24,bool,int256,uint160)) (runs: 256, μ: 776640, ~: 7290)
SafeCastTest:testToInt128(int256) (runs: 256, μ: 1352, ~: 511)
SafeCastTest:testToInt128(uint256) (runs: 256, μ: 1355, ~: 390)
Expand Down
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Uniswap v4 Core

[![Lint](https://github.com/Uniswap/core-next/actions/workflows/lint.yml/badge.svg)](https://github.com/Uniswap/core-next/actions/workflows/lint.yml)
[![Tests](https://github.com/Uniswap/core-next/actions/workflows/tests.yml/badge.svg)](https://github.com/Uniswap/core-next/actions/workflows/tests.yml)
[![Lint](https://github.com/Uniswap/v4-core/actions/workflows/lint.yml/badge.svg)](https://github.com/Uniswap/v4-core/actions/workflows/lint.yml)
[![Tests](https://github.com/Uniswap/v4-core/actions/workflows/tests.yml/badge.svg)](https://github.com/Uniswap/v4-core/actions/workflows/tests.yml)

Uniswap v4 is a new automated market market protocol that provides extensibility and customizability to pools. `v4-core` hosts the core pool logic for creating pools and executing pool actions like swapping and providing liquidity.
Uniswap v4 is a new automated market market protocol that provides extensibility and customizability to pools. `v4-core` hosts the core pool logic for creating pools and executing pool actions like swapping and providing liquidity.

## Architecture

`v4-core` uses a singleton-style architecture, where all pool state is managed in the `PoolManager.sol` contract. Pool actions can be taken by acquiring a lock on the contract and implementing the `lockAcquired` callback to then proceed with any of the following actions on the pools:
`v4-core` uses a singleton-style architecture, where all pool state is managed in the `PoolManager.sol` contract. Pool actions can be taken by acquiring a lock on the contract and implementing the `lockAcquired` callback to then proceed with any of the following actions on the pools:

- `swap`
- `modifyPosition`
Expand All @@ -33,9 +33,9 @@ Read a more in-depth overview of the design decisions in the working v4-whitepap

## Repository Structure

All contracts are held within the `core-next/contracts` folder.
All contracts are held within the `v4-core/contracts` folder.

Note that helper contracts used by tests are held in the `core-next/contracts/test` subfolder within the contracts folder. Any new test helper contracts should be added here, but all foundry tests are in the `core-next/test/foundry-tests` folder.
Note that helper contracts used by tests are held in the `v4-core/contracts/test` subfolder within the contracts folder. Any new test helper contracts should be added here, but all foundry tests are in the `v4-core/test/foundry-tests` folder.

```markdown
contracts/
Expand All @@ -58,15 +58,15 @@ test/
To utilize the contracts and deploy to a local testnet, you can install the code in your repo with forge:

```markdown
forge install https://github.com/Uniswap/core-next
forge install https://github.com/Uniswap/v4-core
```

To integrate with the contracts, the interfaces are available to use:

```solidity
import {IPoolManager} from 'core-next/contracts/interfaces/IPoolManager.sol';
import {ILockCallback} from 'core-next/contracts/interfaces/callback/ILockCallback.sol';
import {IPoolManager} from 'v4-core/contracts/interfaces/IPoolManager.sol';
import {ILockCallback} from 'v4-core/contracts/interfaces/callback/ILockCallback.sol';
contract MyContract is ILockCallback {
IPoolManager poolManager;
Expand All @@ -86,9 +86,14 @@ contract MyContract is ILockCallback {

## Contributing

If you’re interested in contributing please see the [contribution guidelines](https://github.com/Uniswap/core-next/blob/main/CONTRIBUTING.md)!
If you’re interested in contributing please see the [contribution guidelines](https://github.com/Uniswap/v4-core/blob/main/CONTRIBUTING.md)!

## License

The primary license for Uniswap V4 Core is the Business Source License 1.1 (`BUSL-1.1`), see [LICENSE](https://github.com/Uniswap/core-next/blob/main/LICENSE)
The primary license for Uniswap V4 Core is the Business Source License 1.1 (`BUSL-1.1`), see [LICENSE](https://github.com/Uniswap/v4-core/blob/main/LICENSE). Minus the following exceptions:

- [Interfaces](./contracts/interfaces) have a General Public License
- Some [libraries](./contracts/libraries) and [types](./contracts/types/) have a General Public License
- [FullMath.sol](./contracts/libraries/FullMath.sol) has an MIT License

Each of these files states their license type.
2 changes: 1 addition & 1 deletion contracts/NoDelegateCall.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

/// @title Prevents delegatecall to a contract
Expand Down
2 changes: 1 addition & 1 deletion contracts/Owned.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

contract Owned {
Expand Down
2 changes: 1 addition & 1 deletion contracts/PoolManager.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

import {Hooks} from "./libraries/Hooks.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IDynamicFeeManager.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

import {IPoolManager} from "./IPoolManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IHooks.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

import {IPoolManager} from "./IPoolManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IPoolManager.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

import {Currency} from "../libraries/CurrencyLibrary.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IProtocolFeeController.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

import {IPoolManager} from "./IPoolManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/callback/ILockCallback.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

interface ILockCallback {
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/Hooks.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

import {IHooks} from "../interfaces/IHooks.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/Pool.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

import {SafeCast} from "./SafeCast.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/PoolId.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

import {IPoolManager} from "../interfaces/IPoolManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/Position.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

import {FullMath} from "./FullMath.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/SqrtPriceMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

import {SafeCast} from "./SafeCast.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/SwapMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

import {FullMath} from "./FullMath.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/TickBitmap.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

import {BitMath} from "./BitMath.sol";
Expand Down

0 comments on commit 24f3b2e

Please sign in to comment.