Ver Fonte

池子信息拉取前期准备工作完成

skyfffire há 3 anos atrás
pai
commit
ff06ed59b7

+ 452 - 0
abi/410_V2_TOOLS.json

@@ -0,0 +1,452 @@
+[
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			}
+		],
+		"name": "fee_Cal",
+		"outputs": [
+			{
+				"internalType": "uint256",
+				"name": "",
+				"type": "uint256"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			}
+		],
+		"name": "feeCal1",
+		"outputs": [
+			{
+				"internalType": "uint256",
+				"name": "",
+				"type": "uint256"
+			},
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "token",
+				"type": "address"
+			}
+		],
+		"name": "get_decimals",
+		"outputs": [
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "token",
+				"type": "address"
+			}
+		],
+		"name": "get_symbol",
+		"outputs": [
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "token",
+				"type": "address"
+			}
+		],
+		"name": "getDecimals",
+		"outputs": [
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			}
+		],
+		"name": "getFactory",
+		"outputs": [
+			{
+				"internalType": "address",
+				"name": "factoryAdd",
+				"type": "address"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "token0",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "token1",
+				"type": "address"
+			}
+		],
+		"name": "getPairAdd",
+		"outputs": [
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address[]",
+				"name": "factoryAddr",
+				"type": "address[]"
+			},
+			{
+				"internalType": "address",
+				"name": "token0",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "token1",
+				"type": "address"
+			}
+		],
+		"name": "getPairAddS",
+		"outputs": [
+			{
+				"internalType": "address[]",
+				"name": "pairAdds",
+				"type": "address[]"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "dex",
+				"type": "address"
+			}
+		],
+		"name": "getPairBalance",
+		"outputs": [
+			{
+				"internalType": "uint256",
+				"name": "amount0",
+				"type": "uint256"
+			},
+			{
+				"internalType": "uint256",
+				"name": "amount1",
+				"type": "uint256"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			},
+			{
+				"internalType": "uint256",
+				"name": "id",
+				"type": "uint256"
+			}
+		],
+		"name": "getPairIdInfo",
+		"outputs": [
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			},
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			},
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			},
+			{
+				"internalType": "uint256",
+				"name": "",
+				"type": "uint256"
+			},
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			},
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			},
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			},
+			{
+				"internalType": "uint256",
+				"name": "",
+				"type": "uint256"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			},
+			{
+				"internalType": "uint256[]",
+				"name": "id",
+				"type": "uint256[]"
+			}
+		],
+		"name": "getPairIdSInfo",
+		"outputs": [
+			{
+				"internalType": "address[]",
+				"name": "lp",
+				"type": "address[]"
+			},
+			{
+				"internalType": "address[]",
+				"name": "token0",
+				"type": "address[]"
+			},
+			{
+				"internalType": "string[]",
+				"name": "symbol0",
+				"type": "string[]"
+			},
+			{
+				"internalType": "uint8[]",
+				"name": "decimals0",
+				"type": "uint8[]"
+			},
+			{
+				"internalType": "uint256[]",
+				"name": "r0",
+				"type": "uint256[]"
+			},
+			{
+				"internalType": "address[]",
+				"name": "token1",
+				"type": "address[]"
+			},
+			{
+				"internalType": "string[]",
+				"name": "symbol1",
+				"type": "string[]"
+			},
+			{
+				"internalType": "uint8[]",
+				"name": "decimals1",
+				"type": "uint8[]"
+			},
+			{
+				"internalType": "uint256[]",
+				"name": "r1",
+				"type": "uint256[]"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "pairAdd",
+				"type": "address"
+			}
+		],
+		"name": "getPairInfo",
+		"outputs": [
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			},
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			},
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			},
+			{
+				"internalType": "uint256",
+				"name": "",
+				"type": "uint256"
+			},
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			},
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			},
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			},
+			{
+				"internalType": "uint256",
+				"name": "",
+				"type": "uint256"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address[]",
+				"name": "path",
+				"type": "address[]"
+			}
+		],
+		"name": "getPairSBalance",
+		"outputs": [
+			{
+				"internalType": "uint256[]",
+				"name": "amounts0",
+				"type": "uint256[]"
+			},
+			{
+				"internalType": "uint256[]",
+				"name": "amounts1",
+				"type": "uint256[]"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "token",
+				"type": "address"
+			}
+		],
+		"name": "getSymbol",
+		"outputs": [
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			}
+		],
+		"name": "getTotalPair",
+		"outputs": [
+			{
+				"internalType": "uint256",
+				"name": "counts",
+				"type": "uint256"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	}
+]

+ 633 - 0
abi/410_V3_TOOLS.json

@@ -0,0 +1,633 @@
+[
+	{
+		"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": "getAmountInV3",
+		"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": "amountIn",
+				"type": "uint256"
+			},
+			{
+				"internalType": "uint160",
+				"name": "sqrtPriceLimitX96",
+				"type": "uint160"
+			}
+		],
+		"name": "getAmountOutV3",
+		"outputs": [
+			{
+				"internalType": "uint256",
+				"name": "amountOut",
+				"type": "uint256"
+			}
+		],
+		"stateMutability": "nonpayable",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "token",
+				"type": "address"
+			}
+		],
+		"name": "get_decimals",
+		"outputs": [
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "token",
+				"type": "address"
+			}
+		],
+		"name": "get_symbol",
+		"outputs": [
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "token",
+				"type": "address"
+			}
+		],
+		"name": "getDecimals",
+		"outputs": [
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			}
+		],
+		"name": "getFactory",
+		"outputs": [
+			{
+				"internalType": "address",
+				"name": "factoryAdd",
+				"type": "address"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address[]",
+				"name": "factoryAddr",
+				"type": "address[]"
+			},
+			{
+				"internalType": "address",
+				"name": "token0",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "token1",
+				"type": "address"
+			}
+		],
+		"name": "getPairAddS",
+		"outputs": [
+			{
+				"internalType": "address[]",
+				"name": "pairAdds",
+				"type": "address[]"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "token0",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "token1",
+				"type": "address"
+			},
+			{
+				"internalType": "bool",
+				"name": "stable",
+				"type": "bool"
+			}
+		],
+		"name": "getPairAddV1",
+		"outputs": [
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "factoryAddr",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "token0",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "token1",
+				"type": "address"
+			}
+		],
+		"name": "getPairAddV2",
+		"outputs": [
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "dex",
+				"type": "address"
+			}
+		],
+		"name": "getPairBalance",
+		"outputs": [
+			{
+				"internalType": "uint112",
+				"name": "amount0",
+				"type": "uint112"
+			},
+			{
+				"internalType": "uint112",
+				"name": "amount1",
+				"type": "uint112"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "factoryAddr",
+				"type": "address"
+			},
+			{
+				"internalType": "uint256",
+				"name": "id",
+				"type": "uint256"
+			}
+		],
+		"name": "getPairIdInfo",
+		"outputs": [
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			},
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			},
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			},
+			{
+				"internalType": "uint256",
+				"name": "",
+				"type": "uint256"
+			},
+			{
+				"internalType": "address",
+				"name": "",
+				"type": "address"
+			},
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			},
+			{
+				"internalType": "uint8",
+				"name": "",
+				"type": "uint8"
+			},
+			{
+				"internalType": "uint256",
+				"name": "",
+				"type": "uint256"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "factoryAddr",
+				"type": "address"
+			},
+			{
+				"internalType": "uint256[]",
+				"name": "id",
+				"type": "uint256[]"
+			}
+		],
+		"name": "getPairIdSInfo",
+		"outputs": [
+			{
+				"internalType": "address[]",
+				"name": "lp",
+				"type": "address[]"
+			},
+			{
+				"internalType": "address[]",
+				"name": "token0",
+				"type": "address[]"
+			},
+			{
+				"internalType": "string[]",
+				"name": "symbol0",
+				"type": "string[]"
+			},
+			{
+				"internalType": "uint8[]",
+				"name": "decimals0",
+				"type": "uint8[]"
+			},
+			{
+				"internalType": "uint256[]",
+				"name": "r0",
+				"type": "uint256[]"
+			},
+			{
+				"internalType": "address[]",
+				"name": "token1",
+				"type": "address[]"
+			},
+			{
+				"internalType": "string[]",
+				"name": "symbol1",
+				"type": "string[]"
+			},
+			{
+				"internalType": "uint8[]",
+				"name": "decimals1",
+				"type": "uint8[]"
+			},
+			{
+				"internalType": "uint256[]",
+				"name": "r1",
+				"type": "uint256[]"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "pairAdd",
+				"type": "address"
+			}
+		],
+		"name": "getPairInfo",
+		"outputs": [
+			{
+				"components": [
+					{
+						"internalType": "address",
+						"name": "lp",
+						"type": "address"
+					},
+					{
+						"internalType": "address",
+						"name": "token0",
+						"type": "address"
+					},
+					{
+						"internalType": "string",
+						"name": "symbol0",
+						"type": "string"
+					},
+					{
+						"internalType": "uint8",
+						"name": "decimals0",
+						"type": "uint8"
+					},
+					{
+						"internalType": "uint256",
+						"name": "r0",
+						"type": "uint256"
+					},
+					{
+						"internalType": "address",
+						"name": "token1",
+						"type": "address"
+					},
+					{
+						"internalType": "string",
+						"name": "symbol1",
+						"type": "string"
+					},
+					{
+						"internalType": "uint8",
+						"name": "decimals1",
+						"type": "uint8"
+					},
+					{
+						"internalType": "uint256",
+						"name": "r1",
+						"type": "uint256"
+					},
+					{
+						"internalType": "uint24",
+						"name": "fee",
+						"type": "uint24"
+					}
+				],
+				"internalType": "struct dexInfoTools.PairInfo",
+				"name": "pairInfo",
+				"type": "tuple"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "uint256",
+				"name": "id",
+				"type": "uint256"
+			}
+		],
+		"name": "getPairInfoV3",
+		"outputs": [
+			{
+				"components": [
+					{
+						"internalType": "address",
+						"name": "lp",
+						"type": "address"
+					},
+					{
+						"internalType": "address",
+						"name": "token0",
+						"type": "address"
+					},
+					{
+						"internalType": "string",
+						"name": "symbol0",
+						"type": "string"
+					},
+					{
+						"internalType": "uint8",
+						"name": "decimals0",
+						"type": "uint8"
+					},
+					{
+						"internalType": "uint256",
+						"name": "r0",
+						"type": "uint256"
+					},
+					{
+						"internalType": "address",
+						"name": "token1",
+						"type": "address"
+					},
+					{
+						"internalType": "string",
+						"name": "symbol1",
+						"type": "string"
+					},
+					{
+						"internalType": "uint8",
+						"name": "decimals1",
+						"type": "uint8"
+					},
+					{
+						"internalType": "uint256",
+						"name": "r1",
+						"type": "uint256"
+					},
+					{
+						"internalType": "uint24",
+						"name": "fee",
+						"type": "uint24"
+					}
+				],
+				"internalType": "struct dexInfoTools.PairInfo",
+				"name": "pairInfo",
+				"type": "tuple"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address[]",
+				"name": "path",
+				"type": "address[]"
+			}
+		],
+		"name": "getPairSBalance",
+		"outputs": [
+			{
+				"internalType": "uint112[]",
+				"name": "amounts0",
+				"type": "uint112[]"
+			},
+			{
+				"internalType": "uint112[]",
+				"name": "amounts1",
+				"type": "uint112[]"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "tokenA",
+				"type": "address"
+			},
+			{
+				"internalType": "address",
+				"name": "tokenB",
+				"type": "address"
+			},
+			{
+				"internalType": "uint24",
+				"name": "fee",
+				"type": "uint24"
+			}
+		],
+		"name": "getPoolV3",
+		"outputs": [
+			{
+				"internalType": "address",
+				"name": "pool",
+				"type": "address"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "token",
+				"type": "address"
+			}
+		],
+		"name": "getSymbol",
+		"outputs": [
+			{
+				"internalType": "string",
+				"name": "",
+				"type": "string"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	},
+	{
+		"inputs": [
+			{
+				"internalType": "address",
+				"name": "rounteAddr",
+				"type": "address"
+			}
+		],
+		"name": "getTotalPair",
+		"outputs": [
+			{
+				"internalType": "uint256",
+				"name": "counts",
+				"type": "uint256"
+			}
+		],
+		"stateMutability": "view",
+		"type": "function"
+	}
+]

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
abi/UNIV2_ROUTER_ABI.json


+ 3 - 1
config/contracts.ts

@@ -8,5 +8,7 @@ export default {
   QUOTER: '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6',
   ZERO: '0x0000000000000000000000000000000000000000',
   CALC: '0x30c34b111121aCDb423eF2C0e39235Dc68a793A4',
-  FLASH: '0x672746E54B6FB7Bf6748De46271b68B112B79a66'
+  FLASH: '0x672746E54B6FB7Bf6748De46271b68B112B79a66',
+  TOOLS_410_V2: '0x8c72ef5448274f9a79d2a5addb10374dc3f58f08',
+  TOOLS_410_V3: '0xDE93d2cd45b7E0056671A542FfB4343DFd67dA51'
 }

+ 1 - 0
config/routers.ts

@@ -0,0 +1 @@
+export default ['0x7a250d5630b4cf539739df2c5dacb4c659f2488d', '0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f', '0xf6a86eaa9ea0f38f66b3718114ae79acaf35e02f', '0x03f7724180aa6b939894b5ca4314783b0b36b329', '0x53e0e51b5ed9202110d7ecd637a4581db8b9879f', '0x0c17e776cd218252adfca8d4e761d3fe757e9778', '0x25553828f22bdd19a20e4f12f052903cb474a335', '0x45815d3d2cd2a1cfbcf08dcfbdc6e11774ed9e39', '0x8cda39226daf33ae1aba0c92c34d1a1982cf0210', '0x59fe14af3ce9f15b06fb23dad670f3e68f885024', '0xea566e16af328085e75c7b4d3a007cf23f3f208d', '0x1fdd76e18dd21046b7e7d54c8254bf08b239e4d9', '0xdc6844ced486ec04803f02f2ee40bbdbef615f21', '0x07f72839d7a71a117fa859cba643c9291eeba921', '0x3e445e3280c5747a188db8d0ab7762838a50e4ff', '0x05f6bb6b96ca657a3666d2f1bca302b999a671b4', '0x3018234c038d524147ff47148baa8381306f28cf', '0x39d660d507f1bc34dbce94831081d6cf9131c3b9', '0xceb90e4c17d626be0facd78b79c9c87d7ca181b3', '0xb5e9f6c58f548cee53257304e287b23757effca1', '0xb9960d9bca016e9748be75dd52f02188b9d0829f', '0xe6e90bc9f3b95cdb69f48c7bfdd0ede1386b135a', '0xff062471eaf07b50fc1b77e61787301867610f80', '0xfe1f5bb11db3a9dead9d00ceb6f4e607b847d08e', '0xc14d550632db8592d1243edc8b95b0ad06703867', '0x5f509a3c3f16df2fba7bf84dee1efbce6bb85587', '0x6c78d71ce7300343e3633e0c45d6c7a79fee4650', '0xfcdf5cc307964ffabfc14fbd2dc4fad8e0fe9f45', '0xf73ba36cf5466abf1cfbc16ce4096eea135b5ea1', '0xcf7d4b75b7bccdb8b4f992fe05970680e2ee1a02', '0x463672ffded540f7613d3e8248e3a8a51baf7217', '0x3b505af97031b75e2be39e7f8fa1fa634857f29d', '0x1d5c6f1607a171ad52efb270121331b3039dd83e', '0x37d7f26405103c9bc9d8f9352cf32c5b655cbe02', '0x3bc722f252c7bae2f55647e49adcb9d33ff6ebcc', '0x8f589dcef8bc9564c17fba05ab6204e9793c9223', '0xdafb251f372d040f0da0f9b787623aae9cf1acb6', '0xbcc59f7397e78133d0b7ad0e044aaa26015292a1', '0x57556d10e6e9de56d72b9b322d433b9ed06741d0']

+ 2 - 1
hardhat.config.ts

@@ -4,7 +4,8 @@ import "@nomicfoundation/hardhat-toolbox";
 import deployer from './.secret'
 import {HardhatRuntimeEnvironment} from "hardhat/types";
 
-const ETH_RPC = '/ethereum/data/geth.ipc'
+// const ETH_RPC = '/ethereum/data/geth.ipc'
+const ETH_RPC = 'http://3.227.34.41:8545'
 const ETH_W_RPC = 'https://mainnet.ethereumpow.org'
 
 const config: HardhatUserConfig = {

+ 77 - 1
package-lock.json

@@ -6,11 +6,13 @@
     "": {
       "dependencies": {
         "@uniswap/v3-core": "^1.0.1",
-        "@uniswap/v3-periphery": "^1.4.2"
+        "@uniswap/v3-periphery": "^1.4.2",
+        "ts-md5": "^1.3.1"
       },
       "devDependencies": {
         "@nomicfoundation/hardhat-toolbox": "^2.0.0",
         "@nomiclabs/hardhat-web3": "^2.0.0",
+        "axios": "^1.1.2",
         "hardhat": "^2.11.2",
         "mocha": "^10.0.0",
         "request": "^2.88.2",
@@ -2311,6 +2313,31 @@
       "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==",
       "dev": true
     },
+    "node_modules/axios": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.2.tgz",
+      "integrity": "sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==",
+      "dev": true,
+      "dependencies": {
+        "follow-redirects": "^1.15.0",
+        "form-data": "^4.0.0",
+        "proxy-from-env": "^1.1.0"
+      }
+    },
+    "node_modules/axios/node_modules/form-data": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+      "dev": true,
+      "dependencies": {
+        "asynckit": "^0.4.0",
+        "combined-stream": "^1.0.8",
+        "mime-types": "^2.1.12"
+      },
+      "engines": {
+        "node": ">= 6"
+      }
+    },
     "node_modules/balanced-match": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -7748,6 +7775,12 @@
         "node": ">= 0.10"
       }
     },
+    "node_modules/proxy-from-env": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+      "dev": true
+    },
     "node_modules/psl": {
       "version": "1.9.0",
       "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
@@ -10113,6 +10146,14 @@
       "integrity": "sha512-q3N1xS4vZpRouhYHDPwO0bDW3EZ6SK9CrrDHxi/D6BPReSjpVgWIOpLS2o0gSBZm+7q/wyKp6RVM1AeeW7uyfQ==",
       "dev": true
     },
+    "node_modules/ts-md5": {
+      "version": "1.3.1",
+      "resolved": "https://registry.npmjs.org/ts-md5/-/ts-md5-1.3.1.tgz",
+      "integrity": "sha512-DiwiXfwvcTeZ5wCE0z+2A9EseZsztaiZtGrtSaY5JOD7ekPnR/GoIVD5gXZAlK9Na9Kvpo9Waz5rW64WKAWApg==",
+      "engines": {
+        "node": ">=12"
+      }
+    },
     "node_modules/ts-node": {
       "version": "10.9.1",
       "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
@@ -12999,6 +13040,30 @@
       "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==",
       "dev": true
     },
+    "axios": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.2.tgz",
+      "integrity": "sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==",
+      "dev": true,
+      "requires": {
+        "follow-redirects": "^1.15.0",
+        "form-data": "^4.0.0",
+        "proxy-from-env": "^1.1.0"
+      },
+      "dependencies": {
+        "form-data": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+          "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+          "dev": true,
+          "requires": {
+            "asynckit": "^0.4.0",
+            "combined-stream": "^1.0.8",
+            "mime-types": "^2.1.12"
+          }
+        }
+      }
+    },
     "balanced-match": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -17290,6 +17355,12 @@
         "ipaddr.js": "1.9.1"
       }
     },
+    "proxy-from-env": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+      "dev": true
+    },
     "psl": {
       "version": "1.9.0",
       "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
@@ -19134,6 +19205,11 @@
         }
       }
     },
+    "ts-md5": {
+      "version": "1.3.1",
+      "resolved": "https://registry.npmjs.org/ts-md5/-/ts-md5-1.3.1.tgz",
+      "integrity": "sha512-DiwiXfwvcTeZ5wCE0z+2A9EseZsztaiZtGrtSaY5JOD7ekPnR/GoIVD5gXZAlK9Na9Kvpo9Waz5rW64WKAWApg=="
+    },
     "ts-node": {
       "version": "10.9.1",
       "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",

+ 3 - 1
package.json

@@ -2,6 +2,7 @@
   "devDependencies": {
     "@nomicfoundation/hardhat-toolbox": "^2.0.0",
     "@nomiclabs/hardhat-web3": "^2.0.0",
+    "axios": "^1.1.2",
     "hardhat": "^2.11.2",
     "mocha": "^10.0.0",
     "request": "^2.88.2",
@@ -13,6 +14,7 @@
   },
   "dependencies": {
     "@uniswap/v3-core": "^1.0.1",
-    "@uniswap/v3-periphery": "^1.4.2"
+    "@uniswap/v3-periphery": "^1.4.2",
+    "ts-md5": "^1.3.1"
   }
 }

+ 23 - 0
scripts/interface/history.ts

@@ -0,0 +1,23 @@
+import http from './http'
+
+export default class History {
+  static async findByHashOrBlockOrDataVague(block: String, hashCode: String, dataVague: String) {
+    let url = '/ethmev/findByHashOrBlockOrDataVague'
+    const rst = await http.post(url, {
+      block: block,
+      hash: hashCode,
+      dataVague: dataVague
+    })
+    return rst.data
+  }
+
+  static async appendOrUpdate(block: String, hashCode: String, data: any) {
+    let url = '/ethmev/appendOrUpdate'
+    const rst = await http.post(url, {
+      'block': block,
+      'hash': hashCode,
+      'data': JSON.stringify(data)
+    })
+    return rst.data
+  }
+}

+ 33 - 0
scripts/interface/http.ts

@@ -0,0 +1,33 @@
+import axios from 'axios'
+import { Md5 } from 'ts-md5'
+import qs from 'qs'
+import {replaceAll} from "hardhat/internal/util/strings";
+
+axios.defaults.baseURL = 'http://www.410eth.com:8088'
+
+axios.interceptors.request.use(
+  function(config) {
+    // auth
+    let timestamp = parseInt((Date.parse(new Date().toString()) / 1000) + '')
+    let baseStr = '410410' + timestamp
+    let splitStrList = baseStr.split("")
+    let replacedStr = replaceAll(baseStr, splitStrList[splitStrList.length - 1], "")
+    let authStr = Md5.hashStr(replacedStr)
+
+    config.data.timestamp = timestamp
+    config.data.auth = authStr
+
+    // headers处理
+    // @ts-ignore
+    config.headers['content-type'] = 'application/x-www-form-urlencoded'
+    config.data = qs.stringify(config.data)
+
+    return config;
+  },
+  function(error) {
+    // Do something with request error
+    return Promise.reject(error);
+  }
+)
+
+export default axios

+ 20 - 0
scripts/pullv2.ts

@@ -0,0 +1,20 @@
+import { web3 } from "hardhat";
+import History from "./interface/history";
+import contracts from "../config/contracts";
+
+async function main() {
+  // const appendRst = await History.appendOrUpdate('UNIV2DEX', '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', {"now": 0})
+  // console.log(appendRst)
+  // console.log(JSON.stringify(await History.findByHashOrBlockOrDataVague('UNIV2DEX', '', '')))
+
+  // const univ2_tool_abi = require('../abi/410_V2_TOOLS.json')
+  // const univ2_tool_410 = new web3.eth.Contract(univ2_tool_abi, contracts.TOOLS_410_V2)
+  console.log('Pull start.')
+  // const pairIdInfo = await univ2_tool_410.methods.getPairIdInfo('0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', 0).call()
+  // console.log(pairIdInfo)
+}
+
+main().catch((error) => {
+  console.error(error);
+  process.exitCode = 1;
+})

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff