Skip to content
Verified contractPartialGPL-3.0

UniswapCalculations

Address0xef0b54dba501524ef5c827e5bdf4a4d4e4c4b76f
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
License
GPL-3.0
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
18,433,408
Creation transaction
0x6d2c6f3632…c94ec6d24b
Libraries
src/helpers/OracleHelperLibrary.sol:OracleHelperLibrary0xa87a…40ea90src/libraries/UniswapCalculations.sol:UniswapCalculations0xef0b…c4b76f

Read3

  • Q96() → (uint256)
  • calculateAmountsForSwap(tuple,uint256,uint256,uint24) → (uint256,uint256)
  • calculateTargetRatioOfToken1(tuple,uint256) → (uint256)

ABI as JSON

[
  {
    "name": "Q96",
    "type": "function",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  },
  {
    "name": "calculateAmountsForSwap",
    "type": "function",
    "inputs": [
      {
        "name": "position",
        "type": "tuple",
        "components": [
          {
            "name": "sqrtLowerPriceX96",
            "type": "uint160",
            "internalType": "uint160"
          },
          {
            "name": "sqrtUpperPriceX96",
            "type": "uint160",
            "internalType": "uint160"
          },
          {
            "name": "sqrtPriceX96",
            "type": "uint160",
            "internalType": "uint160"
          }
        ],
        "internalType": "struct UniswapCalculations.PositionParams"
      },
      {
        "name": "amount0",
        "type": "uint256",
        "internalType": "uint256"
      },
      {
        "name": "amount1",
        "type": "uint256",
        "internalType": "uint256"
      },
      {
        "name": "swapFee",
        "type": "uint24",
        "internalType": "uint24"
      }
    ],
    "outputs": [
      {
        "name": "tokenInIndex",
        "type": "uint256",
        "internalType": "uint256"
      },
      {
        "name": "amountIn",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "pure"
  },
  {
    "name": "calculateTargetRatioOfToken1",
    "type": "function",
    "inputs": [
      {
        "name": "position",
        "type": "tuple",
        "components": [
          {
            "name": "sqrtLowerPriceX96",
            "type": "uint160",
            "internalType": "uint160"
          },
          {
            "name": "sqrtUpperPriceX96",
            "type": "uint160",
            "internalType": "uint160"
          },
          {
            "name": "sqrtPriceX96",
            "type": "uint160",
            "internalType": "uint160"
          }
        ],
        "internalType": "struct UniswapCalculations.PositionParams"
      },
      {
        "name": "priceX96",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [
      {
        "name": "targetRatioOfToken1X96",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "pure"
  }
]

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.