From 4dd0a128742dae8bd85b6763bb0dbfaad5ee47b1 Mon Sep 17 00:00:00 2001 From: Sara Reynolds Date: Thu, 18 Mar 2021 13:58:19 -0700 Subject: [PATCH] updated spacing --- contract.hbs | 10 ++- docs/V3/reference/NoDelegateCall.md | 1 - docs/V3/reference/UniswapV3Factory.md | 7 +- docs/V3/reference/UniswapV3Pool.md | 38 +++++++--- docs/V3/reference/UniswapV3PoolDeployer.md | 1 - docs/V3/reference/interfaces/IERC20Minimal.md | 25 +++++-- .../reference/interfaces/IUniswapV3Factory.md | 28 +++++--- .../interfaces/IUniswapV3PoolDeployer.md | 1 - .../callback/IUniswapV3FlashCallback.md | 4 +- .../callback/IUniswapV3MintCallback.md | 4 +- .../callback/IUniswapV3SwapCallback.md | 4 +- .../interfaces/pool/IUniswapV3PoolActions.md | 27 ++++++-- .../pool/IUniswapV3PoolDerivedState.md | 3 +- .../interfaces/pool/IUniswapV3PoolEvents.md | 69 ++++++++++++++++--- .../pool/IUniswapV3PoolImmutables.md | 6 -- .../pool/IUniswapV3PoolOwnerActions.md | 7 +- .../interfaces/pool/IUniswapV3PoolState.md | 5 -- docs/V3/reference/libraries/FullMath.md | 8 ++- docs/V3/reference/libraries/LiquidityMath.md | 1 - docs/V3/reference/libraries/LowGasSafeMath.md | 5 -- docs/V3/reference/libraries/Oracle.md | 23 +++++-- docs/V3/reference/libraries/Position.md | 10 ++- docs/V3/reference/libraries/SafeCast.md | 3 - docs/V3/reference/libraries/SecondsOutside.md | 25 +++++-- docs/V3/reference/libraries/SqrtPriceMath.md | 38 +++++++--- docs/V3/reference/libraries/SwapMath.md | 6 +- docs/V3/reference/libraries/Tick.md | 24 +++++-- docs/V3/reference/libraries/TickBitmap.md | 9 ++- docs/V3/reference/libraries/TransferHelper.md | 4 +- docs/V3/reference/libraries/UnsafeMath.md | 1 - 30 files changed, 297 insertions(+), 100 deletions(-) diff --git a/contract.hbs b/contract.hbs index 4e5ddc3041..b573d719e7 100644 --- a/contract.hbs +++ b/contract.hbs @@ -8,7 +8,9 @@ ### {{name}} ```solidity function {{name}}( - {{args}} + {{#natspec.params}} + {{#lookup ../args.types @index}}{{/lookup}} {{param}}{{#if @last}}{{else}},{{/if}} + {{/natspec.params}} ) {{visibility}}{{#if outputs}} returns ({{outputs}}){{/if}} ``` {{#if natspec.userdoc}}{{natspec.userdoc}}{{/if}} @@ -32,7 +34,11 @@ {{#ownEvents}} ### {{name}} ```solidity - event {{name}}({{args}}) + event {{name}}( + {{#natspec.params}} + {{#lookup ../args.types @index}}{{/lookup}} {{param}}{{#if @last}}{{else}},{{/if}} + {{/natspec.params}} + ) ``` {{#if natspec.userdoc}}{{natspec.userdoc}}{{/if}} {{#if natspec.devdoc}}{{natspec.devdoc}}{{/if}} diff --git a/docs/V3/reference/NoDelegateCall.md b/docs/V3/reference/NoDelegateCall.md index 77a7866d49..a36393f8a7 100644 --- a/docs/V3/reference/NoDelegateCall.md +++ b/docs/V3/reference/NoDelegateCall.md @@ -5,7 +5,6 @@ Base contract that provides a modifier for preventing delegatecall to methods in ### constructor ```solidity function constructor( - ) internal ``` diff --git a/docs/V3/reference/UniswapV3Factory.md b/docs/V3/reference/UniswapV3Factory.md index 7b14c082ba..1977de26eb 100644 --- a/docs/V3/reference/UniswapV3Factory.md +++ b/docs/V3/reference/UniswapV3Factory.md @@ -5,7 +5,9 @@ Deploys Uniswap V3 pools and manages ownership and control over pool protocol fe ### createPool ```solidity function createPool( - address tokenA, address tokenB, uint24 fee + address tokenA, + address tokenB, + uint24 fee ) external returns (address pool) ``` Creates a pool for the given two tokens and fee @@ -43,7 +45,8 @@ Must be called by the current owner ### enableFeeAmount ```solidity function enableFeeAmount( - uint24 fee, int24 tickSpacing + uint24 fee, + int24 tickSpacing ) public ``` Enables a fee amount with the given tickSpacing diff --git a/docs/V3/reference/UniswapV3Pool.md b/docs/V3/reference/UniswapV3Pool.md index 10c48b1f3c..41caa5b290 100644 --- a/docs/V3/reference/UniswapV3Pool.md +++ b/docs/V3/reference/UniswapV3Pool.md @@ -5,7 +5,6 @@ ### _blockTimestamp ```solidity function _blockTimestamp( - ) internal returns (uint32) ``` @@ -15,7 +14,8 @@ Returns the block timestamp truncated to 32 bits, i.e. mod 2**32. This method is ### secondsInside ```solidity function secondsInside( - int24 tickLower, int24 tickUpper + int24 tickLower, + int24 tickUpper ) external returns (uint32) ``` Returns a relative timestamp value representing how long, in seconds, the pool has spent between @@ -93,7 +93,11 @@ not locked because it initializes unlocked ### mint ```solidity function mint( - address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes data + address recipient, + int24 tickLower, + int24 tickUpper, + uint128 amount, + bytes data ) external returns (uint256 amount0, uint256 amount1) ``` Adds liquidity for the given recipient/tickLower/tickUpper position @@ -116,7 +120,11 @@ noDelegateCall is applied indirectly via _modifyPosition ### collect ```solidity function collect( - address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested + address recipient, + int24 tickLower, + int24 tickUpper, + uint128 amount0Requested, + uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1) ``` Collects fees owed to a position @@ -142,7 +150,9 @@ pass any value greater than the fees owed. ### burn ```solidity function burn( - int24 tickLower, int24 tickUpper, uint128 amount + int24 tickLower, + int24 tickUpper, + uint128 amount ) external returns (uint256 amount0, uint256 amount1) ``` Burn liquidity from the sender and account tokens owed for the liquidity to the position @@ -163,7 +173,11 @@ noDelegateCall is applied indirectly via _modifyPosition ### swap ```solidity function swap( - address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes data + address recipient, + bool zeroForOne, + int256 amountSpecified, + uint160 sqrtPriceLimitX96, + bytes data ) external returns (int256 amount0, int256 amount1) ``` Swap token0 for token1, or token1 for token0 @@ -188,7 +202,10 @@ value after the swap. If one for zero, the price cannot be greater than this val ### flash ```solidity function flash( - address recipient, uint256 amount0, uint256 amount1, bytes data + address recipient, + uint256 amount0, + uint256 amount1, + bytes data ) external ``` Receive token0 and/or token1 and pay it back, plus a fee, in the callback @@ -208,7 +225,8 @@ with 0 amount{0,1} and sending the donation amount(s) from the callback ### setFeeProtocol ```solidity function setFeeProtocol( - uint8 feeProtocol0, uint8 feeProtocol1 + uint8 feeProtocol0, + uint8 feeProtocol1 ) external ``` Set the denominator of the protocol's % share of the fees @@ -223,7 +241,9 @@ Set the denominator of the protocol's % share of the fees ### collectProtocol ```solidity function collectProtocol( - address recipient, uint128 amount0Requested, uint128 amount1Requested + address recipient, + uint128 amount0Requested, + uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1) ``` Collect the protocol fee accrued to the pool diff --git a/docs/V3/reference/UniswapV3PoolDeployer.md b/docs/V3/reference/UniswapV3PoolDeployer.md index 5f181b01b0..1224eed631 100644 --- a/docs/V3/reference/UniswapV3PoolDeployer.md +++ b/docs/V3/reference/UniswapV3PoolDeployer.md @@ -5,7 +5,6 @@ ### deploy ```solidity function deploy( - address factory, address token0, address token1, uint24 fee, int24 tickSpacing ) internal returns (address pool) ``` diff --git a/docs/V3/reference/interfaces/IERC20Minimal.md b/docs/V3/reference/interfaces/IERC20Minimal.md index f11d4c48d4..697085aff0 100644 --- a/docs/V3/reference/interfaces/IERC20Minimal.md +++ b/docs/V3/reference/interfaces/IERC20Minimal.md @@ -23,7 +23,8 @@ Returns the balance of a token ### transfer ```solidity function transfer( - address recipient, uint256 amount + address recipient, + uint256 amount ) external returns (bool) ``` Transfers the amount of token from the `msg.sender` to the recipient @@ -42,7 +43,8 @@ Transfers the amount of token from the `msg.sender` to the recipient ### allowance ```solidity function allowance( - address owner, address spender + address owner, + address spender ) external returns (uint256) ``` Returns the current allowance given to a spender by an owner @@ -61,7 +63,8 @@ Returns the current allowance given to a spender by an owner ### approve ```solidity function approve( - address spender, uint256 amount + address spender, + uint256 amount ) external returns (bool) ``` Sets the allowance of a spender from the `msg.sender` to the value `amount` @@ -80,7 +83,9 @@ Sets the allowance of a spender from the `msg.sender` to the value `amount` ### transferFrom ```solidity function transferFrom( - address sender, address recipient, uint256 amount + address sender, + address recipient, + uint256 amount ) external returns (bool) ``` Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender` @@ -100,7 +105,11 @@ Transfers `amount` tokens from `sender` to `recipient` up to the allowance given ## Events ### Transfer ```solidity - event Transfer(address from, address to, uint256 value) + event Transfer( + address from, + address to, + uint256 value + ) ``` Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`. @@ -113,7 +122,11 @@ Event emitted when tokens are transferred from one address to another, either vi |`value`| uint256 | The amount of tokens that were transferred ### Approval ```solidity - event Approval(address owner, address spender, uint256 value) + event Approval( + address owner, + address spender, + uint256 value + ) ``` Event emitted when the approval amount for the spender of a given owner's tokens changes. diff --git a/docs/V3/reference/interfaces/IUniswapV3Factory.md b/docs/V3/reference/interfaces/IUniswapV3Factory.md index 6e0c010480..a5a45d54a6 100644 --- a/docs/V3/reference/interfaces/IUniswapV3Factory.md +++ b/docs/V3/reference/interfaces/IUniswapV3Factory.md @@ -5,7 +5,6 @@ The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over ### owner ```solidity function owner( - ) external returns (address) ``` Returns the current owner of the factory @@ -20,7 +19,6 @@ Can be changed by the current owner via setOwner ### feeAmountTickSpacing ```solidity function feeAmountTickSpacing( - uint24 fee ) external returns (int24) ``` Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled @@ -35,7 +33,6 @@ A fee amount can never bee removed, so this value should be hard coded or cached ### getPool ```solidity function getPool( - address tokenA, address tokenB, uint24 fee ) external returns (address pool) ``` Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist @@ -50,7 +47,9 @@ tokenA and tokenB may be passed in either token0/token1 or token1/token0 order ### createPool ```solidity function createPool( - address tokenA, address tokenB, uint24 fee + address tokenA, + address tokenB, + uint24 fee ) external returns (address pool) ``` Creates a pool for the given two tokens and fee @@ -88,7 +87,8 @@ Must be called by the current owner ### enableFeeAmount ```solidity function enableFeeAmount( - uint24 fee, int24 tickSpacing + uint24 fee, + int24 tickSpacing ) external ``` Enables a fee amount with the given tickSpacing @@ -104,7 +104,10 @@ Fee amounts may never be removed once enabled ## Events ### OwnerChanged ```solidity - event OwnerChanged(address oldOwner, address newOwner) + event OwnerChanged( + address oldOwner, + address newOwner + ) ``` Emitted when the owner of the factory is changed @@ -116,7 +119,13 @@ Emitted when the owner of the factory is changed |`newOwner`| address | The owner after the owner was changed ### PoolCreated ```solidity - event PoolCreated(address token0, address token1, uint24 fee, int24 tickSpacing, address pool) + event PoolCreated( + address token0, + address token1, + uint24 fee, + int24 tickSpacing, + address pool + ) ``` Emitted when a pool is created @@ -131,7 +140,10 @@ Emitted when a pool is created |`pool`| address | The address of the created pool ### FeeAmountEnabled ```solidity - event FeeAmountEnabled(uint24 fee, int24 tickSpacing) + event FeeAmountEnabled( + uint24 fee, + int24 tickSpacing + ) ``` Emitted when a new fee amount is enabled for pool creation via the factory diff --git a/docs/V3/reference/interfaces/IUniswapV3PoolDeployer.md b/docs/V3/reference/interfaces/IUniswapV3PoolDeployer.md index c9fb065993..79c16bde76 100644 --- a/docs/V3/reference/interfaces/IUniswapV3PoolDeployer.md +++ b/docs/V3/reference/interfaces/IUniswapV3PoolDeployer.md @@ -7,7 +7,6 @@ without storing the entire init code of the pool. ### parameters ```solidity function parameters( - ) external returns (address factory, address token0, address token1, uint24 fee, int24 tickSpacing) ``` Get the parameters to be used in constructing the pool, set transiently during pool creation. diff --git a/docs/V3/reference/interfaces/callback/IUniswapV3FlashCallback.md b/docs/V3/reference/interfaces/callback/IUniswapV3FlashCallback.md index 5fe5b7cf9d..ab7139f158 100644 --- a/docs/V3/reference/interfaces/callback/IUniswapV3FlashCallback.md +++ b/docs/V3/reference/interfaces/callback/IUniswapV3FlashCallback.md @@ -5,7 +5,9 @@ Any contract that calls IUniswapV3PoolActions#flash must implement this interfac ### uniswapV3FlashCallback ```solidity function uniswapV3FlashCallback( - uint256 fee0, uint256 fee1, bytes data + uint256 fee0, + uint256 fee1, + bytes data ) external ``` Called after transferring tokens to the `msg.sender`, allows the sender to perform any actions and then diff --git a/docs/V3/reference/interfaces/callback/IUniswapV3MintCallback.md b/docs/V3/reference/interfaces/callback/IUniswapV3MintCallback.md index fe77e484d6..ef69d33717 100644 --- a/docs/V3/reference/interfaces/callback/IUniswapV3MintCallback.md +++ b/docs/V3/reference/interfaces/callback/IUniswapV3MintCallback.md @@ -5,7 +5,9 @@ Any contract that calls IUniswapV3PoolActions#mint must implement this interface ### uniswapV3MintCallback ```solidity function uniswapV3MintCallback( - uint256 amount0Owed, uint256 amount1Owed, bytes data + uint256 amount0Owed, + uint256 amount1Owed, + bytes data ) external ``` Called on `msg.sender` after making updates to a position. Allows the sender to pay the tokens diff --git a/docs/V3/reference/interfaces/callback/IUniswapV3SwapCallback.md b/docs/V3/reference/interfaces/callback/IUniswapV3SwapCallback.md index 17b2f69684..942c4dd864 100644 --- a/docs/V3/reference/interfaces/callback/IUniswapV3SwapCallback.md +++ b/docs/V3/reference/interfaces/callback/IUniswapV3SwapCallback.md @@ -5,7 +5,9 @@ Any contract that calls IUniswapV3PoolActions#swap must implement this interface ### uniswapV3SwapCallback ```solidity function uniswapV3SwapCallback( - int256 amount0Delta, int256 amount1Delta, bytes data + int256 amount0Delta, + int256 amount1Delta, + bytes data ) external ``` Called on `msg.sender` after performing a swap and transferring any output tokens to the recipient diff --git a/docs/V3/reference/interfaces/pool/IUniswapV3PoolActions.md b/docs/V3/reference/interfaces/pool/IUniswapV3PoolActions.md index 5acbf227f2..041ce888f1 100644 --- a/docs/V3/reference/interfaces/pool/IUniswapV3PoolActions.md +++ b/docs/V3/reference/interfaces/pool/IUniswapV3PoolActions.md @@ -20,7 +20,11 @@ Price is represented as a sqrt(token1/token0) Q64.96 value ### mint ```solidity function mint( - address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes data + address recipient, + int24 tickLower, + int24 tickUpper, + uint128 amount, + bytes data ) external returns (uint256 amount0, uint256 amount1) ``` Adds liquidity for the given recipient/tickLower/tickUpper position @@ -46,7 +50,11 @@ on tickLower, tickUpper, the amount of liquidity, and the current price. ### collect ```solidity function collect( - address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested + address recipient, + int24 tickLower, + int24 tickUpper, + uint128 amount0Requested, + uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1) ``` Collects fees owed to a position @@ -72,7 +80,9 @@ pass any value greater than the fees owed. ### burn ```solidity function burn( - int24 tickLower, int24 tickUpper, uint128 amount + int24 tickLower, + int24 tickUpper, + uint128 amount ) external returns (uint256 amount0, uint256 amount1) ``` Burn liquidity from the sender and account tokens owed for the liquidity to the position @@ -95,7 +105,11 @@ Fees must be collected separately via a call to #collect ### swap ```solidity function swap( - address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes data + address recipient, + bool zeroForOne, + int256 amountSpecified, + uint160 sqrtPriceLimitX96, + bytes data ) external returns (int256 amount0, int256 amount1) ``` Swap token0 for token1, or token1 for token0 @@ -120,7 +134,10 @@ value after the swap. If one for zero, the price cannot be greater than this val ### flash ```solidity function flash( - address recipient, uint256 amount0, uint256 amount1, bytes data + address recipient, + uint256 amount0, + uint256 amount1, + bytes data ) external ``` Receive token0 and/or token1 and pay it back, plus a fee, in the callback diff --git a/docs/V3/reference/interfaces/pool/IUniswapV3PoolDerivedState.md b/docs/V3/reference/interfaces/pool/IUniswapV3PoolDerivedState.md index 0b33b4d703..f3312d2a14 100644 --- a/docs/V3/reference/interfaces/pool/IUniswapV3PoolDerivedState.md +++ b/docs/V3/reference/interfaces/pool/IUniswapV3PoolDerivedState.md @@ -6,7 +6,8 @@ blockchain. The functions here may have variable gas costs. ### secondsInside ```solidity function secondsInside( - int24 tickLower, int24 tickUpper + int24 tickLower, + int24 tickUpper ) external returns (uint32) ``` Returns a relative timestamp value representing how long, in seconds, the pool has spent between diff --git a/docs/V3/reference/interfaces/pool/IUniswapV3PoolEvents.md b/docs/V3/reference/interfaces/pool/IUniswapV3PoolEvents.md index 7b7fc052c7..0aa8039a77 100644 --- a/docs/V3/reference/interfaces/pool/IUniswapV3PoolEvents.md +++ b/docs/V3/reference/interfaces/pool/IUniswapV3PoolEvents.md @@ -4,7 +4,10 @@ Contains all events emitted by the pool ## Events ### Initialize ```solidity - event Initialize(uint160 sqrtPriceX96, int24 tick) + event Initialize( + uint160 sqrtPriceX96, + int24 tick + ) ``` Emitted exactly once by a pool when #initialize is first called on the pool @@ -17,7 +20,15 @@ Mint/Burn/Swap cannot be emitted by the pool before Initialize |`tick`| int24 | The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool ### Mint ```solidity - event Mint(address sender, address owner, int24 tickLower, int24 tickUpper, uint128 amount, uint256 amount0, uint256 amount1) + event Mint( + address sender, + address owner, + int24 tickLower, + int24 tickUpper, + uint128 amount, + uint256 amount0, + uint256 amount1 + ) ``` Emitted when liquidity is minted for a given position @@ -34,7 +45,13 @@ Emitted when liquidity is minted for a given position |`amount1`| uint256 | How much token1 was required for the minted liquidity ### Collect ```solidity - event Collect(address owner, address recipient, int24 tickLower, int24 tickUpper, uint128 amount0, uint128 amount1) + event Collect( + address owner, + address tickLower, + int24 tickUpper, + int24 amount0, + uint128 amount1 + ) ``` Emitted when fees are collected by the owner of a position @@ -50,7 +67,14 @@ Collect events may be emitted with zero amount0 and amount1 when the caller choo |`amount1`| uint128 | The amount of token1 fees collected ### Burn ```solidity - event Burn(address owner, int24 tickLower, int24 tickUpper, uint128 amount, uint256 amount0, uint256 amount1) + event Burn( + address owner, + int24 tickLower, + int24 tickUpper, + uint128 amount, + uint256 amount0, + uint256 amount1 + ) ``` Emitted when a position's liquidity is removed @@ -67,7 +91,14 @@ Does not withdraw any fees earned by the liquidity position, which must be withd |`amount1`| uint256 | The amount of token1 withdrawn ### Swap ```solidity - event Swap(address sender, address recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, int24 tick) + event Swap( + address sender, + address recipient, + int256 amount0, + int256 amount1, + uint160 sqrtPriceX96, + int24 tick + ) ``` Emitted by the pool for any swaps between token0 and token1 @@ -83,7 +114,14 @@ Emitted by the pool for any swaps between token0 and token1 |`tick`| int24 | The log base 1.0001 of price of the pool after the swap ### Flash ```solidity - event Flash(address sender, address recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1) + event Flash( + address sender, + address recipient, + uint256 amount0, + uint256 amount1, + uint256 paid0, + uint256 paid1 + ) ``` Emitted by the pool for any flashes of token0/token1 @@ -99,7 +137,10 @@ Emitted by the pool for any flashes of token0/token1 |`paid1`| uint256 | The amount of token1 paid for the flash, which can exceed the amount1 plus the fee ### IncreaseObservationCardinalityNext ```solidity - event IncreaseObservationCardinalityNext(uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew) + event IncreaseObservationCardinalityNext( + uint16 observationCardinalityNextOld, + uint16 observationCardinalityNextNew + ) ``` Emitted by the pool for increases to the number of observations that can be stored @@ -113,7 +154,12 @@ just before a mint/swap/burn. |`observationCardinalityNextNew`| uint16 | The updated value of the next observation cardinality ### SetFeeProtocol ```solidity - event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New) + event SetFeeProtocol( + uint8 feeProtocol0Old, + uint8 feeProtocol1Old, + uint8 feeProtocol0New, + uint8 feeProtocol1New + ) ``` Emitted when the protocol fee is changed by the pool @@ -127,7 +173,12 @@ Emitted when the protocol fee is changed by the pool |`feeProtocol1New`| uint8 | The updated value of the token1 protocol fee ### CollectProtocol ```solidity - event CollectProtocol(address sender, address recipient, uint128 amount0, uint128 amount1) + event CollectProtocol( + address sender, + address recipient, + uint128 amount0, + uint128 amount0 + ) ``` Emitted when the collected protocol fees are withdrawn by the factory owner diff --git a/docs/V3/reference/interfaces/pool/IUniswapV3PoolImmutables.md b/docs/V3/reference/interfaces/pool/IUniswapV3PoolImmutables.md index 6bd0645592..b2cb81a049 100644 --- a/docs/V3/reference/interfaces/pool/IUniswapV3PoolImmutables.md +++ b/docs/V3/reference/interfaces/pool/IUniswapV3PoolImmutables.md @@ -5,7 +5,6 @@ These parameters are fixed for a pool forever, i.e., the methods will always ret ### factory ```solidity function factory( - ) external returns (address) ``` The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface @@ -19,7 +18,6 @@ The contract that deployed the pool, which must adhere to the IUniswapV3Factory ### token0 ```solidity function token0( - ) external returns (address) ``` The first of the two tokens of the pool, sorted by address @@ -33,7 +31,6 @@ The first of the two tokens of the pool, sorted by address ### token1 ```solidity function token1( - ) external returns (address) ``` The second of the two tokens of the pool, sorted by address @@ -47,7 +44,6 @@ The second of the two tokens of the pool, sorted by address ### fee ```solidity function fee( - ) external returns (uint24) ``` The pool's fee in hundredths of a bip, i.e. 1e-6 @@ -61,7 +57,6 @@ The pool's fee in hundredths of a bip, i.e. 1e-6 ### tickSpacing ```solidity function tickSpacing( - ) external returns (int24) ``` The pool tick spacing @@ -78,7 +73,6 @@ This value is an int24 to avoid casting even though it is always positive. ### maxLiquidityPerTick ```solidity function maxLiquidityPerTick( - ) external returns (uint128) ``` The maximum amount of position liquidity that can use any tick in the range diff --git a/docs/V3/reference/interfaces/pool/IUniswapV3PoolOwnerActions.md b/docs/V3/reference/interfaces/pool/IUniswapV3PoolOwnerActions.md index ec1d7d148d..fbbbb00852 100644 --- a/docs/V3/reference/interfaces/pool/IUniswapV3PoolOwnerActions.md +++ b/docs/V3/reference/interfaces/pool/IUniswapV3PoolOwnerActions.md @@ -5,7 +5,8 @@ Contains pool methods that may only be called by the factory owner ### setFeeProtocol ```solidity function setFeeProtocol( - uint8 feeProtocol0, uint8 feeProtocol1 + uint8 feeProtocol0, + uint8 feeProtocol1 ) external ``` Set the denominator of the protocol's % share of the fees @@ -20,7 +21,9 @@ Set the denominator of the protocol's % share of the fees ### collectProtocol ```solidity function collectProtocol( - address recipient, uint128 amount0Requested, uint128 amount1Requested + address recipient, + uint128 amount0Requested, + uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1) ``` Collect the protocol fee accrued to the pool diff --git a/docs/V3/reference/interfaces/pool/IUniswapV3PoolState.md b/docs/V3/reference/interfaces/pool/IUniswapV3PoolState.md index ee002f661c..6b4af75cf6 100644 --- a/docs/V3/reference/interfaces/pool/IUniswapV3PoolState.md +++ b/docs/V3/reference/interfaces/pool/IUniswapV3PoolState.md @@ -6,7 +6,6 @@ per transaction ### slot0 ```solidity function slot0( - ) external returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked) ``` The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas @@ -30,7 +29,6 @@ unlocked Whether the pool is currently locked to reentrancy ### feeGrowthGlobal0X128 ```solidity function feeGrowthGlobal0X128( - ) external returns (uint256) ``` The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool @@ -41,7 +39,6 @@ This value can overflow the uint256 ### feeGrowthGlobal1X128 ```solidity function feeGrowthGlobal1X128( - ) external returns (uint256) ``` The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool @@ -52,7 +49,6 @@ This value can overflow the uint256 ### protocolFees ```solidity function protocolFees( - ) external returns (uint128 token0, uint128 token1) ``` The amounts of token0 and token1 that are owed to the protocol @@ -63,7 +59,6 @@ Protocol fees will never exceed uint128 max in either token ### liquidity ```solidity function liquidity( - ) external returns (uint128) ``` The currently in range liquidity available to the pool diff --git a/docs/V3/reference/libraries/FullMath.md b/docs/V3/reference/libraries/FullMath.md index 82e3c662c6..36f6b9b87c 100644 --- a/docs/V3/reference/libraries/FullMath.md +++ b/docs/V3/reference/libraries/FullMath.md @@ -6,7 +6,9 @@ Handles "phantom overflow" i.e., allows multiplication and division where an int ### mulDiv ```solidity function mulDiv( - uint256 a, uint256 b, uint256 denominator + uint256 a, + uint256 b, + uint256 denominator ) internal returns (uint256 result) ``` Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 @@ -27,7 +29,9 @@ Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv ### mulDivRoundingUp ```solidity function mulDivRoundingUp( - uint256 a, uint256 b, uint256 denominator + uint256 a, + uint256 b, + uint256 denominator ) internal returns (uint256 result) ``` / @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 diff --git a/docs/V3/reference/libraries/LiquidityMath.md b/docs/V3/reference/libraries/LiquidityMath.md index f06e339043..5d03423b15 100644 --- a/docs/V3/reference/libraries/LiquidityMath.md +++ b/docs/V3/reference/libraries/LiquidityMath.md @@ -5,7 +5,6 @@ ### addDelta ```solidity function addDelta( - uint128 x, int128 y ) internal returns (uint128 z) ``` Add a signed liquidity delta to liquidity and revert if it overflows or underflows diff --git a/docs/V3/reference/libraries/LowGasSafeMath.md b/docs/V3/reference/libraries/LowGasSafeMath.md index d4ea248752..3ca6c282bf 100644 --- a/docs/V3/reference/libraries/LowGasSafeMath.md +++ b/docs/V3/reference/libraries/LowGasSafeMath.md @@ -5,7 +5,6 @@ Contains methods for doing math operations that revert on overflow or underflow ### add ```solidity function add( - uint256 x, uint256 y ) internal returns (uint256 z) ``` Returns x + y, reverts if sum overflows uint256 @@ -19,7 +18,6 @@ Returns x + y, reverts if sum overflows uint256 ### sub ```solidity function sub( - uint256 x, uint256 y ) internal returns (uint256 z) ``` Returns x - y, reverts if underflows @@ -33,7 +31,6 @@ Returns x - y, reverts if underflows ### mul ```solidity function mul( - uint256 x, uint256 y ) internal returns (uint256 z) ``` Returns x * y, reverts if overflows @@ -47,7 +44,6 @@ Returns x * y, reverts if overflows ### add ```solidity function add( - int256 x, int256 y ) internal returns (int256 z) ``` Returns x + y, reverts if overflows or underflows @@ -61,7 +57,6 @@ Returns x + y, reverts if overflows or underflows ### sub ```solidity function sub( - int256 x, int256 y ) internal returns (int256 z) ``` Returns x - y, reverts if overflows or underflows diff --git a/docs/V3/reference/libraries/Oracle.md b/docs/V3/reference/libraries/Oracle.md index 13f4b5a066..97cfa0d877 100644 --- a/docs/V3/reference/libraries/Oracle.md +++ b/docs/V3/reference/libraries/Oracle.md @@ -10,7 +10,8 @@ The most recent observation is available, independent of the length of the oracl ### initialize ```solidity function initialize( - struct Oracle.Observation[65535] self, uint32 time + struct Oracle.Observation[65535] self, + uint32 time ) internal returns (uint16 cardinality, uint16 cardinalityNext) ``` Initialize the oracle array by writing the first slot. Called once for the lifecycle of the observations array @@ -30,7 +31,13 @@ Initialize the oracle array by writing the first slot. Called once for the lifec ### write ```solidity function write( - struct Oracle.Observation[65535] self, uint16 index, uint32 blockTimestamp, int24 tick, uint128 liquidity, uint16 cardinality, uint16 cardinalityNext + struct Oracle.Observation[65535] self, + uint16 index, + uint32 blockTimestamp, + int24 tick, + uint128 liquidity, + uint16 cardinality, + uint16 cardinalityNext ) internal returns (uint16 indexUpdated, uint16 cardinalityUpdated) ``` Writes an oracle observation to the array @@ -58,7 +65,9 @@ is greater than the current one, cardinality may be increased. This restriction ### grow ```solidity function grow( - struct Oracle.Observation[65535] self, uint16 current, uint16 next + struct Oracle.Observation[65535] self, + uint16 current, + uint16 next ) internal returns (uint16) ``` Prepares the oracle array to store up to `next` observations @@ -78,7 +87,13 @@ Prepares the oracle array to store up to `next` observations ### observe ```solidity function observe( - struct Oracle.Observation[65535] self, uint32 time, uint32[] secondsAgos, int24 tick, uint16 index, uint128 liquidity, uint16 cardinality + struct Oracle.Observation[65535] self, + uint32 time, + uint32[] secondsAgos, + int24 tick, + uint16 index, + uint128 liquidity, + uint16 cardinality ) internal returns (int56[] tickCumulatives, uint160[] liquidityCumulatives) ``` Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos` diff --git a/docs/V3/reference/libraries/Position.md b/docs/V3/reference/libraries/Position.md index b39c3ce010..c32a5a604f 100644 --- a/docs/V3/reference/libraries/Position.md +++ b/docs/V3/reference/libraries/Position.md @@ -6,7 +6,10 @@ Positions store additional state for tracking fees owed to the position ### get ```solidity function get( - mapping(bytes32 => struct Position.Info) self, address owner, int24 tickLower, int24 tickUpper + mapping(bytes32 => struct Position.Info) self, + address owner, + int24 tickLower, + int24 tickUpper ) internal returns (struct Position.Info position) ``` Returns the Info struct of a position, given an owner and position boundaries @@ -27,7 +30,10 @@ Returns the Info struct of a position, given an owner and position boundaries ### update ```solidity function update( - struct Position.Info self, int128 liquidityDelta, uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128 + struct Position.Info self, + int128 liquidityDelta, + uint256 feeGrowthInside0X128, + uint256 feeGrowthInside1X128 ) internal ``` Credits accumulated fees to a user's position diff --git a/docs/V3/reference/libraries/SafeCast.md b/docs/V3/reference/libraries/SafeCast.md index e1acd47802..c7e455183a 100644 --- a/docs/V3/reference/libraries/SafeCast.md +++ b/docs/V3/reference/libraries/SafeCast.md @@ -5,7 +5,6 @@ Contains methods for safely downcasting to smaller types ### toUint160 ```solidity function toUint160( - uint256 y ) internal returns (uint160 z) ``` Cast a uint256 to a uint160, revert on overflow @@ -19,7 +18,6 @@ Cast a uint256 to a uint160, revert on overflow ### toInt128 ```solidity function toInt128( - int256 y ) internal returns (int128 z) ``` Cast a int256 to a int128, revert on overflow or underflow @@ -33,7 +31,6 @@ Cast a int256 to a int128, revert on overflow or underflow ### toInt256 ```solidity function toInt256( - uint256 y ) internal returns (int256 z) ``` Cast a uint256 to a int256, revert on overflow diff --git a/docs/V3/reference/libraries/SecondsOutside.md b/docs/V3/reference/libraries/SecondsOutside.md index 5688b64d2d..8d62b0749b 100644 --- a/docs/V3/reference/libraries/SecondsOutside.md +++ b/docs/V3/reference/libraries/SecondsOutside.md @@ -7,7 +7,11 @@ The mapping uses int24 for keys since ticks are represented as int24 and there a ### initialize ```solidity function initialize( - mapping(int24 => uint256) self, int24 tick, int24 tickCurrent, int24 tickSpacing, uint32 time + mapping(int24 => uint256) self, + int24 tick, + int24 tickCurrent, + int24 tickSpacing, + uint32 time ) internal ``` Called the first time a tick is used to set the seconds outside value. Assumes the tick is not @@ -26,7 +30,9 @@ initialized. ### clear ```solidity function clear( - mapping(int24 => uint256) self, int24 tick, int24 tickSpacing + mapping(int24 => uint256) self, + int24 tick, + int24 tickSpacing ) internal ``` Called when a tick is no longer used, to clear the seconds outside value of the tick @@ -42,7 +48,10 @@ Called when a tick is no longer used, to clear the seconds outside value of the ### cross ```solidity function cross( - mapping(int24 => uint256) self, int24 tick, int24 tickSpacing, uint32 time + mapping(int24 => uint256) self, + int24 tick, + int24 tickSpacing, + uint32 time ) internal ``` Called when an initialized tick is crossed to update the seconds outside for that tick. Must be called @@ -60,7 +69,9 @@ every time an initialized tick is crossed ### get ```solidity function get( - mapping(int24 => uint256) self, int24 tick, int24 tickSpacing + mapping(int24 => uint256) self, + int24 tick, + int24 tickSpacing ) internal returns (uint32) ``` Get the seconds outside for an initialized tick. Should be called only on initialized ticks. @@ -80,7 +91,11 @@ Get the seconds outside for an initialized tick. Should be called only on initia ### secondsInside ```solidity function secondsInside( - mapping(int24 => uint256) self, int24 tickLower, int24 tickUpper, int24 tickCurrent, int24 tickSpacing, uint32 time + mapping(int24 => uint256) self, + int24 tickLower, + int24 tickUpper, + int24 tickCurrent, + int24 tickSpacing ) internal returns (uint32) ``` Get the seconds inside a tick range, assuming both tickLower and tickUpper are initialized diff --git a/docs/V3/reference/libraries/SqrtPriceMath.md b/docs/V3/reference/libraries/SqrtPriceMath.md index 8cb2a23d39..5c69895be8 100644 --- a/docs/V3/reference/libraries/SqrtPriceMath.md +++ b/docs/V3/reference/libraries/SqrtPriceMath.md @@ -5,7 +5,10 @@ Contains the math that uses square root of price as a Q64.96 and liquidity to co ### getNextSqrtPriceFromAmount0RoundingUp ```solidity function getNextSqrtPriceFromAmount0RoundingUp( - uint160 sqrtPX96, uint128 liquidity, uint256 amount, bool add + uint160 sqrtPX96, + uint128 liquidity, + uint256 amount, + bool add ) internal returns (uint160) ``` Gets the next sqrt price given a delta of token0 @@ -31,7 +34,10 @@ if this is impossible because of overflow, we calculate liquidity / (liquidity / ### getNextSqrtPriceFromAmount1RoundingDown ```solidity function getNextSqrtPriceFromAmount1RoundingDown( - uint160 sqrtPX96, uint128 liquidity, uint256 amount, bool add + uint160 sqrtPX96, + uint128 liquidity, + uint256 amount, + bool add ) internal returns (uint160) ``` Gets the next sqrt price given a delta of token1 @@ -56,7 +62,10 @@ The formula we compute is lossless: sqrtPX96 +- amount / liquidity ### getNextSqrtPriceFromInput ```solidity function getNextSqrtPriceFromInput( - uint160 sqrtPX96, uint128 liquidity, uint256 amountIn, bool zeroForOne + uint160 sqrtPX96, + uint128 liquidity, + uint256 amountIn, + bool zeroForOne ) internal returns (uint160 sqrtQX96) ``` Gets the next sqrt price given an input amount of token0 or token1 @@ -78,7 +87,10 @@ Throws if price or liquidity are 0, or if the next price is out of bounds ### getNextSqrtPriceFromOutput ```solidity function getNextSqrtPriceFromOutput( - uint160 sqrtPX96, uint128 liquidity, uint256 amountOut, bool zeroForOne + uint160 sqrtPX96, + uint128 liquidity, + uint256 amountOut, + bool zeroForOne ) internal returns (uint160 sqrtQX96) ``` Gets the next sqrt price given an output amount of token0 or token1 @@ -100,7 +112,10 @@ Throws if price or liquidity are 0 or the next price is out of bounds ### getAmount0Delta ```solidity function getAmount0Delta( - uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity, bool roundUp + uint160 sqrtRatioAX96, + uint160 sqrtRatioBX96, + uint128 liquidity, + bool roundUp ) internal returns (uint256 amount0) ``` Gets the amount0 delta between two prices @@ -123,7 +138,10 @@ i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower)) ### getAmount1Delta ```solidity function getAmount1Delta( - uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity, bool roundUp + uint160 sqrtRatioAX96, + uint160 sqrtRatioBX96, + uint128 liquidity, + bool roundUp ) internal returns (uint256 amount1) ``` Gets the amount1 delta between two prices @@ -145,7 +163,9 @@ Calculates liquidity * (sqrt(upper) - sqrt(lower)) ### getAmount0Delta ```solidity function getAmount0Delta( - uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, int128 liquidity + uint160 sqrtRatioAX96, + uint160 sqrtRatioBX96, + int128 liquidity ) internal returns (int256 amount0) ``` Helper that gets signed token0 delta @@ -165,7 +185,9 @@ Helper that gets signed token0 delta ### getAmount1Delta ```solidity function getAmount1Delta( - uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, int128 liquidity + uint160 sqrtRatioAX96, + uint160 sqrtRatioBX96, + int128 liquidity ) internal returns (int256 amount1) ``` Helper that gets signed token1 delta diff --git a/docs/V3/reference/libraries/SwapMath.md b/docs/V3/reference/libraries/SwapMath.md index 7e8a49c7d1..1dc565433f 100644 --- a/docs/V3/reference/libraries/SwapMath.md +++ b/docs/V3/reference/libraries/SwapMath.md @@ -5,7 +5,11 @@ Contains methods for computing the result of a swap within a single tick price r ### computeSwapStep ```solidity function computeSwapStep( - uint160 sqrtRatioCurrentX96, uint160 sqrtRatioTargetX96, uint128 liquidity, int256 amountRemaining, uint24 feePips + uint160 sqrtRatioCurrentX96, + uint160 sqrtRatioTargetX96, + uint128 liquidity, + int256 amountRemaining, + uint24 feePips ) internal returns (uint160 sqrtRatioNextX96, uint256 amountIn, uint256 amountOut, uint256 feeAmount) ``` Computes the result of swapping some amount in, or amount out, given the parameters of the swap diff --git a/docs/V3/reference/libraries/Tick.md b/docs/V3/reference/libraries/Tick.md index 932fca375a..3bf7fe1c6e 100644 --- a/docs/V3/reference/libraries/Tick.md +++ b/docs/V3/reference/libraries/Tick.md @@ -25,7 +25,12 @@ Executed within the pool constructor ### getFeeGrowthInside ```solidity function getFeeGrowthInside( - mapping(int24 => struct Tick.Info) self, int24 tickLower, int24 tickUpper, int24 tickCurrent, uint256 feeGrowthGlobal0X128, uint256 feeGrowthGlobal1X128 + mapping(int24 => struct Tick.Info) self, + int24 tickLower, + int24 tickUpper, + int24 tickCurrent, + uint256 feeGrowthGlobal0X128, + uint256 feeGrowthGlobal1X128 ) internal returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) ``` / @notice Retrieves fee growth data @@ -49,7 +54,14 @@ Executed within the pool constructor ### update ```solidity function update( - mapping(int24 => struct Tick.Info) self, int24 tick, int24 tickCurrent, int128 liquidityDelta, uint256 feeGrowthGlobal0X128, uint256 feeGrowthGlobal1X128, bool upper, uint128 maxLiquidity + mapping(int24 => struct Tick.Info) self, + int24 tick, + int24 tickCurrent, + int128 liquidityDelta, + uint256 feeGrowthGlobal0X128, + uint256 feeGrowthGlobal1X128, + bool upper, + uint128 maxLiquidity ) internal returns (bool flipped) ``` / @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa @@ -74,7 +86,8 @@ Executed within the pool constructor ### clear ```solidity function clear( - mapping(int24 => struct Tick.Info) self, int24 tick + mapping(int24 => struct Tick.Info) self, + int24 tick ) internal ``` / @notice Clears tick data @@ -89,7 +102,10 @@ Executed within the pool constructor ### cross ```solidity function cross( - mapping(int24 => struct Tick.Info) self, int24 tick, uint256 feeGrowthGlobal0X128, uint256 feeGrowthGlobal1X128 + mapping(int24 => struct Tick.Info) self, + int24 tick, + uint256 feeGrowthGlobal0X128, + uint256 feeGrowthGlobal1X128 ) internal returns (int128 liquidityNet) ``` / @notice Transitions to next tick as needed by price movement diff --git a/docs/V3/reference/libraries/TickBitmap.md b/docs/V3/reference/libraries/TickBitmap.md index 95cc165805..a840210653 100644 --- a/docs/V3/reference/libraries/TickBitmap.md +++ b/docs/V3/reference/libraries/TickBitmap.md @@ -6,7 +6,9 @@ The mapping uses int16 for keys since ticks are represented as int24 and there a ### flipTick ```solidity function flipTick( - mapping(int16 => uint256) self, int24 tick, int24 tickSpacing + mapping(int16 => uint256) self, + int24 tick, + int24 tickSpacing ) internal ``` Flips the initialized state for a given tick from false to true, or vice versa @@ -22,7 +24,10 @@ Flips the initialized state for a given tick from false to true, or vice versa ### nextInitializedTickWithinOneWord ```solidity function nextInitializedTickWithinOneWord( - mapping(int16 => uint256) self, int24 tick, int24 tickSpacing, bool lte + mapping(int16 => uint256) self, + int24 tick, + int24 tickSpacing, + bool lte ) internal returns (int24 next, bool initialized) ``` Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either diff --git a/docs/V3/reference/libraries/TransferHelper.md b/docs/V3/reference/libraries/TransferHelper.md index 2ef3677d83..4be90fa106 100644 --- a/docs/V3/reference/libraries/TransferHelper.md +++ b/docs/V3/reference/libraries/TransferHelper.md @@ -5,7 +5,9 @@ Contains helper methods for interacting with ERC20 tokens that do not consistent ### safeTransfer ```solidity function safeTransfer( - address token, address to, uint256 value + address token, + address to, + uint256 value ) internal ``` Transfers tokens from msg.sender to a recipient diff --git a/docs/V3/reference/libraries/UnsafeMath.md b/docs/V3/reference/libraries/UnsafeMath.md index a51699e086..4253c5d554 100644 --- a/docs/V3/reference/libraries/UnsafeMath.md +++ b/docs/V3/reference/libraries/UnsafeMath.md @@ -5,7 +5,6 @@ Contains methods that perform common math functions but do not do any overflow o ### divRoundingUp ```solidity function divRoundingUp( - uint256 x, uint256 y ) internal returns (uint256 z) ``` Returns ceil(x / y)