Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

price fetching refactored; custom gas pricing; misc#389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
liquid-8 merged 1 commit intouniswap-python:dev/v4fromliquid-8:dev
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletionsuniswap/assets/uniswap-v4/quoter.abi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_poolManager",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "poolManager",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "bytes", "name": "path", "type": "bytes" },
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" }
],
"name": "quoteExactInput",
"outputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenIn", "type": "address" },
{ "internalType": "address", "name": "tokenOut", "type": "address" },
{ "internalType": "uint24", "name": "fee", "type": "uint24" },
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
{
"internalType": "uint160",
"name": "sqrtPriceLimitX96",
"type": "uint160"
}
],
"name": "quoteExactInputSingle",
"outputs": [
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "bytes", "name": "path", "type": "bytes" },
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }
],
"name": "quoteExactOutput",
"outputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenIn", "type": "address" },
{ "internalType": "address", "name": "tokenOut", "type": "address" },
{ "internalType": "uint24", "name": "fee", "type": "uint24" },
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
{
"internalType": "uint160",
"name": "sqrtPriceLimitX96",
"type": "uint160"
}
],
"name": "quoteExactOutputSingle",
"outputs": [
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "function"
}
]
12 changes: 11 additions & 1 deletionuniswap/constants.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,7 +74,7 @@
"harmony_testnet": "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
}

# need to replace with actual addresses
# need to replace with actual addresses after release
_poolmanager_contract_addresses = {
"mainnet": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
"ropsten": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
Expand All@@ -85,6 +85,16 @@
"binance_testnet": "0x6725F303b657a9451d8BA641348b6761A6CC7a17",
}

# need to replace with actual addresses after release
_quoter_contract_addresses = {
"mainnet": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
"ropsten": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
"rinkeby": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
"görli": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
"xdai": "0xA818b4F111Ccac7AA31D0BCc0806d64F2E0737D7",
"binance": "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73",
"binance_testnet": "0x6725F303b657a9451d8BA641348b6761A6CC7a17",
}
MAX_UINT_128 = (2**128) - 1

# Source: https://github.com/Uniswap/v3-core/blob/v1.0.0/contracts/libraries/TickMath.sol#L8-L11
Expand Down
16 changes: 16 additions & 0 deletionsuniswap/types.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,3 +32,19 @@ class UniswapV4_tick_info:

def __repr__(self) -> str:
return f"Tick info (liquidityGross: {self.liquidityGross}; liquidityNet: {self.liquidityNet}; feeGrowthOutside0X128: {self.feeGrowthOutside0X128}; feeGrowthOutside1X128: {self.feeGrowthOutside1X128!r})"

@dataclass
class UniswapV4_PathKey:
# The lower currency of the pool, sorted numerically
currency0 : Address
# The higher currency of the pool, sorted numerically
currency1 : Address
# The pool swap fee, capped at 1_000_000. If the first bit is 1, the pool has a dynamic fee and must be exactly equal to 0x800000
fee : int
# Ticks that involve positions must be a multiple of tick spacing
tickSpacing : int
# The hooks of the pool
hooks : list[Address]

def __repr__(self) -> (Address, Address, int, int, list[Address]):
return (self.currency0, self.currency1, self.fee, self.tickSpacing, self.hooks)
Loading

[8]ページ先頭

©2009-2025 Movatter.jp