Last active
August 23, 2023 21:53
-
-
Save BlockmanCodes/7a15d10aae4f6aa03c5f8220827a611f to your computer and use it in GitHub Desktop.
Pancake Swap: exactInputSingle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"inputs": [], | |
"stateMutability": "nonpayable", | |
"type": "constructor" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "owner", | |
"type": "address" | |
}, | |
{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "spender", | |
"type": "address" | |
}, | |
{ | |
"indexed": false, | |
"internalType": "uint256", | |
"name": "value", | |
"type": "uint256" | |
} | |
], | |
"name": "Approval", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "from", | |
"type": "address" | |
}, | |
{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "to", | |
"type": "address" | |
}, | |
{ | |
"indexed": false, | |
"internalType": "uint256", | |
"name": "value", | |
"type": "uint256" | |
} | |
], | |
"name": "Transfer", | |
"type": "event" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "address", | |
"name": "owner", | |
"type": "address" | |
}, | |
{ | |
"internalType": "address", | |
"name": "spender", | |
"type": "address" | |
} | |
], | |
"name": "allowance", | |
"outputs": [ | |
{ | |
"internalType": "uint256", | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "address", | |
"name": "spender", | |
"type": "address" | |
}, | |
{ | |
"internalType": "uint256", | |
"name": "amount", | |
"type": "uint256" | |
} | |
], | |
"name": "approve", | |
"outputs": [ | |
{ | |
"internalType": "bool", | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "address", | |
"name": "account", | |
"type": "address" | |
} | |
], | |
"name": "balanceOf", | |
"outputs": [ | |
{ | |
"internalType": "uint256", | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"inputs": [], | |
"name": "decimals", | |
"outputs": [ | |
{ | |
"internalType": "uint8", | |
"name": "", | |
"type": "uint8" | |
} | |
], | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "address", | |
"name": "spender", | |
"type": "address" | |
}, | |
{ | |
"internalType": "uint256", | |
"name": "subtractedValue", | |
"type": "uint256" | |
} | |
], | |
"name": "decreaseAllowance", | |
"outputs": [ | |
{ | |
"internalType": "bool", | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "address", | |
"name": "spender", | |
"type": "address" | |
}, | |
{ | |
"internalType": "uint256", | |
"name": "addedValue", | |
"type": "uint256" | |
} | |
], | |
"name": "increaseAllowance", | |
"outputs": [ | |
{ | |
"internalType": "bool", | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [], | |
"name": "name", | |
"outputs": [ | |
{ | |
"internalType": "string", | |
"name": "", | |
"type": "string" | |
} | |
], | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"inputs": [], | |
"name": "symbol", | |
"outputs": [ | |
{ | |
"internalType": "string", | |
"name": "", | |
"type": "string" | |
} | |
], | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"inputs": [], | |
"name": "totalSupply", | |
"outputs": [ | |
{ | |
"internalType": "uint256", | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "address", | |
"name": "to", | |
"type": "address" | |
}, | |
{ | |
"internalType": "uint256", | |
"name": "amount", | |
"type": "uint256" | |
} | |
], | |
"name": "transfer", | |
"outputs": [ | |
{ | |
"internalType": "bool", | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "address", | |
"name": "from", | |
"type": "address" | |
}, | |
{ | |
"internalType": "address", | |
"name": "to", | |
"type": "address" | |
}, | |
{ | |
"internalType": "uint256", | |
"name": "amount", | |
"type": "uint256" | |
} | |
], | |
"name": "transferFrom", | |
"outputs": [ | |
{ | |
"internalType": "bool", | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"inputs": [{ | |
"internalType": "address", | |
"name": "_factoryV2", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "_deployer", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "_factoryV3", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "_positionManager", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "_stableFactory", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "_stableInfo", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "_WETH9", | |
"type": "address" | |
}], | |
"stateMutability": "nonpayable", | |
"type": "constructor" | |
}, { | |
"anonymous": false, | |
"inputs": [{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "previousOwner", | |
"type": "address" | |
}, { | |
"indexed": true, | |
"internalType": "address", | |
"name": "newOwner", | |
"type": "address" | |
}], | |
"name": "OwnershipTransferred", | |
"type": "event" | |
}, { | |
"anonymous": false, | |
"inputs": [{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "factory", | |
"type": "address" | |
}, { | |
"indexed": true, | |
"internalType": "address", | |
"name": "info", | |
"type": "address" | |
}], | |
"name": "SetStableSwap", | |
"type": "event" | |
}, { | |
"inputs": [], | |
"name": "WETH9", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}], | |
"name": "approveMax", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}], | |
"name": "approveMaxMinusOne", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}], | |
"name": "approveZeroThenMax", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}], | |
"name": "approveZeroThenMaxMinusOne", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "bytes", | |
"name": "data", | |
"type": "bytes" | |
}], | |
"name": "callPositionManager", | |
"outputs": [{ | |
"internalType": "bytes", | |
"name": "result", | |
"type": "bytes" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "bytes[]", | |
"name": "paths", | |
"type": "bytes[]" | |
}, { | |
"internalType": "uint128[]", | |
"name": "amounts", | |
"type": "uint128[]" | |
}, { | |
"internalType": "uint24", | |
"name": "maximumTickDivergence", | |
"type": "uint24" | |
}, { | |
"internalType": "uint32", | |
"name": "secondsAgo", | |
"type": "uint32" | |
}], | |
"name": "checkOracleSlippage", | |
"outputs": [], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "bytes", | |
"name": "path", | |
"type": "bytes" | |
}, { | |
"internalType": "uint24", | |
"name": "maximumTickDivergence", | |
"type": "uint24" | |
}, { | |
"internalType": "uint32", | |
"name": "secondsAgo", | |
"type": "uint32" | |
}], | |
"name": "checkOracleSlippage", | |
"outputs": [], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "deployer", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"components": [{ | |
"internalType": "bytes", | |
"name": "path", | |
"type": "bytes" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "amountIn", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amountOutMinimum", | |
"type": "uint256" | |
}], | |
"internalType": "struct IV3SwapRouter.ExactInputParams", | |
"name": "params", | |
"type": "tuple" | |
}], | |
"name": "exactInput", | |
"outputs": [{ | |
"internalType": "uint256", | |
"name": "amountOut", | |
"type": "uint256" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"components": [{ | |
"internalType": "address", | |
"name": "tokenIn", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "tokenOut", | |
"type": "address" | |
}, { | |
"internalType": "uint24", | |
"name": "fee", | |
"type": "uint24" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "amountIn", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amountOutMinimum", | |
"type": "uint256" | |
}, { | |
"internalType": "uint160", | |
"name": "sqrtPriceLimitX96", | |
"type": "uint160" | |
}], | |
"internalType": "struct IV3SwapRouter.ExactInputSingleParams", | |
"name": "params", | |
"type": "tuple" | |
}], | |
"name": "exactInputSingle", | |
"outputs": [{ | |
"internalType": "uint256", | |
"name": "amountOut", | |
"type": "uint256" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address[]", | |
"name": "path", | |
"type": "address[]" | |
}, { | |
"internalType": "uint256[]", | |
"name": "flag", | |
"type": "uint256[]" | |
}, { | |
"internalType": "uint256", | |
"name": "amountIn", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amountOutMin", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "to", | |
"type": "address" | |
}], | |
"name": "exactInputStableSwap", | |
"outputs": [{ | |
"internalType": "uint256", | |
"name": "amountOut", | |
"type": "uint256" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"components": [{ | |
"internalType": "bytes", | |
"name": "path", | |
"type": "bytes" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "amountOut", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amountInMaximum", | |
"type": "uint256" | |
}], | |
"internalType": "struct IV3SwapRouter.ExactOutputParams", | |
"name": "params", | |
"type": "tuple" | |
}], | |
"name": "exactOutput", | |
"outputs": [{ | |
"internalType": "uint256", | |
"name": "amountIn", | |
"type": "uint256" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"components": [{ | |
"internalType": "address", | |
"name": "tokenIn", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "tokenOut", | |
"type": "address" | |
}, { | |
"internalType": "uint24", | |
"name": "fee", | |
"type": "uint24" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "amountOut", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amountInMaximum", | |
"type": "uint256" | |
}, { | |
"internalType": "uint160", | |
"name": "sqrtPriceLimitX96", | |
"type": "uint160" | |
}], | |
"internalType": "struct IV3SwapRouter.ExactOutputSingleParams", | |
"name": "params", | |
"type": "tuple" | |
}], | |
"name": "exactOutputSingle", | |
"outputs": [{ | |
"internalType": "uint256", | |
"name": "amountIn", | |
"type": "uint256" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address[]", | |
"name": "path", | |
"type": "address[]" | |
}, { | |
"internalType": "uint256[]", | |
"name": "flag", | |
"type": "uint256[]" | |
}, { | |
"internalType": "uint256", | |
"name": "amountOut", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amountInMax", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "to", | |
"type": "address" | |
}], | |
"name": "exactOutputStableSwap", | |
"outputs": [{ | |
"internalType": "uint256", | |
"name": "amountIn", | |
"type": "uint256" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "factory", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "factoryV2", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "amount", | |
"type": "uint256" | |
}], | |
"name": "getApprovalType", | |
"outputs": [{ | |
"internalType": "enum IApproveAndCall.ApprovalType", | |
"name": "", | |
"type": "uint8" | |
}], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"components": [{ | |
"internalType": "address", | |
"name": "token0", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "token1", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "tokenId", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amount0Min", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amount1Min", | |
"type": "uint256" | |
}], | |
"internalType": "struct IApproveAndCall.IncreaseLiquidityParams", | |
"name": "params", | |
"type": "tuple" | |
}], | |
"name": "increaseLiquidity", | |
"outputs": [{ | |
"internalType": "bytes", | |
"name": "result", | |
"type": "bytes" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"components": [{ | |
"internalType": "address", | |
"name": "token0", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "token1", | |
"type": "address" | |
}, { | |
"internalType": "uint24", | |
"name": "fee", | |
"type": "uint24" | |
}, { | |
"internalType": "int24", | |
"name": "tickLower", | |
"type": "int24" | |
}, { | |
"internalType": "int24", | |
"name": "tickUpper", | |
"type": "int24" | |
}, { | |
"internalType": "uint256", | |
"name": "amount0Min", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amount1Min", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}], | |
"internalType": "struct IApproveAndCall.MintParams", | |
"name": "params", | |
"type": "tuple" | |
}], | |
"name": "mint", | |
"outputs": [{ | |
"internalType": "bytes", | |
"name": "result", | |
"type": "bytes" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "bytes32", | |
"name": "previousBlockhash", | |
"type": "bytes32" | |
}, { | |
"internalType": "bytes[]", | |
"name": "data", | |
"type": "bytes[]" | |
}], | |
"name": "multicall", | |
"outputs": [{ | |
"internalType": "bytes[]", | |
"name": "", | |
"type": "bytes[]" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint256", | |
"name": "deadline", | |
"type": "uint256" | |
}, { | |
"internalType": "bytes[]", | |
"name": "data", | |
"type": "bytes[]" | |
}], | |
"name": "multicall", | |
"outputs": [{ | |
"internalType": "bytes[]", | |
"name": "", | |
"type": "bytes[]" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "bytes[]", | |
"name": "data", | |
"type": "bytes[]" | |
}], | |
"name": "multicall", | |
"outputs": [{ | |
"internalType": "bytes[]", | |
"name": "results", | |
"type": "bytes[]" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "owner", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "int256", | |
"name": "amount0Delta", | |
"type": "int256" | |
}, { | |
"internalType": "int256", | |
"name": "amount1Delta", | |
"type": "int256" | |
}, { | |
"internalType": "bytes", | |
"name": "_data", | |
"type": "bytes" | |
}], | |
"name": "pancakeV3SwapCallback", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "positionManager", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "value", | |
"type": "uint256" | |
}], | |
"name": "pull", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "refundETH", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "renounceOwnership", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "value", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "deadline", | |
"type": "uint256" | |
}, { | |
"internalType": "uint8", | |
"name": "v", | |
"type": "uint8" | |
}, { | |
"internalType": "bytes32", | |
"name": "r", | |
"type": "bytes32" | |
}, { | |
"internalType": "bytes32", | |
"name": "s", | |
"type": "bytes32" | |
}], | |
"name": "selfPermit", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "nonce", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "expiry", | |
"type": "uint256" | |
}, { | |
"internalType": "uint8", | |
"name": "v", | |
"type": "uint8" | |
}, { | |
"internalType": "bytes32", | |
"name": "r", | |
"type": "bytes32" | |
}, { | |
"internalType": "bytes32", | |
"name": "s", | |
"type": "bytes32" | |
}], | |
"name": "selfPermitAllowed", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "nonce", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "expiry", | |
"type": "uint256" | |
}, { | |
"internalType": "uint8", | |
"name": "v", | |
"type": "uint8" | |
}, { | |
"internalType": "bytes32", | |
"name": "r", | |
"type": "bytes32" | |
}, { | |
"internalType": "bytes32", | |
"name": "s", | |
"type": "bytes32" | |
}], | |
"name": "selfPermitAllowedIfNecessary", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "value", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "deadline", | |
"type": "uint256" | |
}, { | |
"internalType": "uint8", | |
"name": "v", | |
"type": "uint8" | |
}, { | |
"internalType": "bytes32", | |
"name": "r", | |
"type": "bytes32" | |
}, { | |
"internalType": "bytes32", | |
"name": "s", | |
"type": "bytes32" | |
}], | |
"name": "selfPermitIfNecessary", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "_factory", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "_info", | |
"type": "address" | |
}], | |
"name": "setStableSwap", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "stableSwapFactory", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "stableSwapInfo", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint256", | |
"name": "amountIn", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amountOutMin", | |
"type": "uint256" | |
}, { | |
"internalType": "address[]", | |
"name": "path", | |
"type": "address[]" | |
}, { | |
"internalType": "address", | |
"name": "to", | |
"type": "address" | |
}], | |
"name": "swapExactTokensForTokens", | |
"outputs": [{ | |
"internalType": "uint256", | |
"name": "amountOut", | |
"type": "uint256" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint256", | |
"name": "amountOut", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "amountInMax", | |
"type": "uint256" | |
}, { | |
"internalType": "address[]", | |
"name": "path", | |
"type": "address[]" | |
}, { | |
"internalType": "address", | |
"name": "to", | |
"type": "address" | |
}], | |
"name": "swapTokensForExactTokens", | |
"outputs": [{ | |
"internalType": "uint256", | |
"name": "amountIn", | |
"type": "uint256" | |
}], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "amountMinimum", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}], | |
"name": "sweepToken", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "amountMinimum", | |
"type": "uint256" | |
}], | |
"name": "sweepToken", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "amountMinimum", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "feeBips", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "feeRecipient", | |
"type": "address" | |
}], | |
"name": "sweepTokenWithFee", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "token", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "amountMinimum", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "feeBips", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "feeRecipient", | |
"type": "address" | |
}], | |
"name": "sweepTokenWithFee", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "newOwner", | |
"type": "address" | |
}], | |
"name": "transferOwnership", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint256", | |
"name": "amountMinimum", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}], | |
"name": "unwrapWETH9", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint256", | |
"name": "amountMinimum", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}, { | |
"internalType": "uint256", | |
"name": "feeBips", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "feeRecipient", | |
"type": "address" | |
}], | |
"name": "unwrapWETH9WithFee", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint256", | |
"name": "amountMinimum", | |
"type": "uint256" | |
}, { | |
"internalType": "uint256", | |
"name": "feeBips", | |
"type": "uint256" | |
}, { | |
"internalType": "address", | |
"name": "feeRecipient", | |
"type": "address" | |
}], | |
"name": "unwrapWETH9WithFee", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint256", | |
"name": "value", | |
"type": "uint256" | |
}], | |
"name": "wrapETH", | |
"outputs": [], | |
"stateMutability": "payable", | |
"type": "function" | |
}, { | |
"stateMutability": "payable", | |
"type": "receive" | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"inputs": [{ | |
"internalType": "address", | |
"name": "_poolDeployer", | |
"type": "address" | |
}], | |
"stateMutability": "nonpayable", | |
"type": "constructor" | |
}, { | |
"anonymous": false, | |
"inputs": [{ | |
"indexed": true, | |
"internalType": "uint24", | |
"name": "fee", | |
"type": "uint24" | |
}, { | |
"indexed": true, | |
"internalType": "int24", | |
"name": "tickSpacing", | |
"type": "int24" | |
}], | |
"name": "FeeAmountEnabled", | |
"type": "event" | |
}, { | |
"anonymous": false, | |
"inputs": [{ | |
"indexed": true, | |
"internalType": "uint24", | |
"name": "fee", | |
"type": "uint24" | |
}, { | |
"indexed": false, | |
"internalType": "bool", | |
"name": "whitelistRequested", | |
"type": "bool" | |
}, { | |
"indexed": false, | |
"internalType": "bool", | |
"name": "enabled", | |
"type": "bool" | |
}], | |
"name": "FeeAmountExtraInfoUpdated", | |
"type": "event" | |
}, { | |
"anonymous": false, | |
"inputs": [{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "oldOwner", | |
"type": "address" | |
}, { | |
"indexed": true, | |
"internalType": "address", | |
"name": "newOwner", | |
"type": "address" | |
}], | |
"name": "OwnerChanged", | |
"type": "event" | |
}, { | |
"anonymous": false, | |
"inputs": [{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "token0", | |
"type": "address" | |
}, { | |
"indexed": true, | |
"internalType": "address", | |
"name": "token1", | |
"type": "address" | |
}, { | |
"indexed": true, | |
"internalType": "uint24", | |
"name": "fee", | |
"type": "uint24" | |
}, { | |
"indexed": false, | |
"internalType": "int24", | |
"name": "tickSpacing", | |
"type": "int24" | |
}, { | |
"indexed": false, | |
"internalType": "address", | |
"name": "pool", | |
"type": "address" | |
}], | |
"name": "PoolCreated", | |
"type": "event" | |
}, { | |
"anonymous": false, | |
"inputs": [{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "lmPoolDeployer", | |
"type": "address" | |
}], | |
"name": "SetLmPoolDeployer", | |
"type": "event" | |
}, { | |
"anonymous": false, | |
"inputs": [{ | |
"indexed": true, | |
"internalType": "address", | |
"name": "user", | |
"type": "address" | |
}, { | |
"indexed": false, | |
"internalType": "bool", | |
"name": "verified", | |
"type": "bool" | |
}], | |
"name": "WhiteListAdded", | |
"type": "event" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "pool", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "recipient", | |
"type": "address" | |
}, { | |
"internalType": "uint128", | |
"name": "amount0Requested", | |
"type": "uint128" | |
}, { | |
"internalType": "uint128", | |
"name": "amount1Requested", | |
"type": "uint128" | |
}], | |
"name": "collectProtocol", | |
"outputs": [{ | |
"internalType": "uint128", | |
"name": "amount0", | |
"type": "uint128" | |
}, { | |
"internalType": "uint128", | |
"name": "amount1", | |
"type": "uint128" | |
}], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "tokenA", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "tokenB", | |
"type": "address" | |
}, { | |
"internalType": "uint24", | |
"name": "fee", | |
"type": "uint24" | |
}], | |
"name": "createPool", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "pool", | |
"type": "address" | |
}], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint24", | |
"name": "fee", | |
"type": "uint24" | |
}, { | |
"internalType": "int24", | |
"name": "tickSpacing", | |
"type": "int24" | |
}], | |
"name": "enableFeeAmount", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint24", | |
"name": "", | |
"type": "uint24" | |
}], | |
"name": "feeAmountTickSpacing", | |
"outputs": [{ | |
"internalType": "int24", | |
"name": "", | |
"type": "int24" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint24", | |
"name": "", | |
"type": "uint24" | |
}], | |
"name": "feeAmountTickSpacingExtraInfo", | |
"outputs": [{ | |
"internalType": "bool", | |
"name": "whitelistRequested", | |
"type": "bool" | |
}, { | |
"internalType": "bool", | |
"name": "enabled", | |
"type": "bool" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}, { | |
"internalType": "uint24", | |
"name": "", | |
"type": "uint24" | |
}], | |
"name": "getPool", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "lmPoolDeployer", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "owner", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [], | |
"name": "poolDeployer", | |
"outputs": [{ | |
"internalType": "address", | |
"name": "", | |
"type": "address" | |
}], | |
"stateMutability": "view", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "uint24", | |
"name": "fee", | |
"type": "uint24" | |
}, { | |
"internalType": "bool", | |
"name": "whitelistRequested", | |
"type": "bool" | |
}, { | |
"internalType": "bool", | |
"name": "enabled", | |
"type": "bool" | |
}], | |
"name": "setFeeAmountExtraInfo", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "pool", | |
"type": "address" | |
}, { | |
"internalType": "uint32", | |
"name": "feeProtocol0", | |
"type": "uint32" | |
}, { | |
"internalType": "uint32", | |
"name": "feeProtocol1", | |
"type": "uint32" | |
}], | |
"name": "setFeeProtocol", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "pool", | |
"type": "address" | |
}, { | |
"internalType": "address", | |
"name": "lmPool", | |
"type": "address" | |
}], | |
"name": "setLmPool", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "_lmPoolDeployer", | |
"type": "address" | |
}], | |
"name": "setLmPoolDeployer", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "_owner", | |
"type": "address" | |
}], | |
"name": "setOwner", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, { | |
"inputs": [{ | |
"internalType": "address", | |
"name": "user", | |
"type": "address" | |
}, { | |
"internalType": "bool", | |
"name": "verified", | |
"type": "bool" | |
}], | |
"name": "setWhiteListAddress", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "name", | |
"outputs": [{ "name": "", "type": "string" }], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ "name": "guy", "type": "address" }, | |
{ "name": "wad", "type": "uint256" } | |
], | |
"name": "approve", | |
"outputs": [{ "name": "", "type": "bool" }], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "totalSupply", | |
"outputs": [{ "name": "", "type": "uint256" }], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ "name": "src", "type": "address" }, | |
{ "name": "dst", "type": "address" }, | |
{ "name": "wad", "type": "uint256" } | |
], | |
"name": "transferFrom", | |
"outputs": [{ "name": "", "type": "bool" }], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [{ "name": "wad", "type": "uint256" }], | |
"name": "withdraw", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "decimals", | |
"outputs": [{ "name": "", "type": "uint8" }], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [{ "name": "", "type": "address" }], | |
"name": "balanceOf", | |
"outputs": [{ "name": "", "type": "uint256" }], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "symbol", | |
"outputs": [{ "name": "", "type": "string" }], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ "name": "dst", "type": "address" }, | |
{ "name": "wad", "type": "uint256" } | |
], | |
"name": "transfer", | |
"outputs": [{ "name": "", "type": "bool" }], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [], | |
"name": "deposit", | |
"outputs": [], | |
"payable": true, | |
"stateMutability": "payable", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [ | |
{ "name": "", "type": "address" }, | |
{ "name": "", "type": "address" } | |
], | |
"name": "allowance", | |
"outputs": [{ "name": "", "type": "uint256" }], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ "payable": true, "stateMutability": "payable", "type": "fallback" }, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ "indexed": true, "name": "src", "type": "address" }, | |
{ "indexed": true, "name": "guy", "type": "address" }, | |
{ "indexed": false, "name": "wad", "type": "uint256" } | |
], | |
"name": "Approval", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ "indexed": true, "name": "src", "type": "address" }, | |
{ "indexed": true, "name": "dst", "type": "address" }, | |
{ "indexed": false, "name": "wad", "type": "uint256" } | |
], | |
"name": "Transfer", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ "indexed": true, "name": "dst", "type": "address" }, | |
{ "indexed": false, "name": "wad", "type": "uint256" } | |
], | |
"name": "Deposit", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ "indexed": true, "name": "src", "type": "address" }, | |
{ "indexed": false, "name": "wad", "type": "uint256" } | |
], | |
"name": "Withdrawal", | |
"type": "event" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("@nomiclabs/hardhat-waffle"); | |
/** @type import('hardhat/config').HardhatUserConfig */ | |
module.exports = { | |
solidity: "0.8.18", | |
networks: { | |
hardhat: { | |
forking: { | |
url: "https://mainnet.infura.io/v3/<YOUR_INFURA_KEY>" | |
} | |
} | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "swap-tokens", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"@nomiclabs/hardhat-ethers": "^2.2.3", | |
"@nomiclabs/hardhat-waffle": "^2.0.6", | |
"ethers": "^5.7.2", | |
"hardhat": "^2.14.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hardhat = require("hardhat"); | |
const smartRouterAbi = require('../abis/pancakeSmartRouter.json') | |
const smartRouterAddress = '0x13f4EA83D0bd40E75C8222255bc855a974568Dd4' | |
const factoryAbi = require('../abis/pancakeFactory.json') | |
const factoryAddress = '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865' | |
const wethAbi = require('../abis/weth.json') | |
const usdcAddress = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' | |
const usdcAbi = require('../abis/erc20.json') | |
const wethAddress = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' | |
async function main() { | |
const provider = hardhat.ethers.provider; | |
const factoryContract = new hardhat.ethers.Contract(factoryAddress, factoryAbi, provider) | |
const poolAddress = await factoryContract.getPool(wethAddress, usdcAddress, '500') | |
console.log('poolAddress', poolAddress) | |
const signerAddress = "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B" | |
const signer = await hardhat.ethers.getImpersonatedSigner(signerAddress); | |
const wethContract = new hardhat.ethers.Contract(wethAddress, wethAbi, provider) | |
const usdcContract = new hardhat.ethers.Contract(usdcAddress, usdcAbi, provider) | |
const amountIn = hardhat.ethers.utils.parseUnits('1', '18') | |
await wethContract.connect(signer).approve(smartRouterAddress, amountIn.toString()) | |
console.log('approved!') | |
const smartRouterContract = new hardhat.ethers.Contract(smartRouterAddress, smartRouterAbi, provider) | |
const params = { | |
tokenIn: wethAddress, | |
tokenOut: usdcAddress, | |
fee: '500', | |
recipient: signerAddress, | |
deadline: Math.floor(Date.now() / 1000) + 60 * 10, | |
amountIn, | |
amountOutMinimum: 0, | |
sqrtPriceLimitX96: 0, | |
} | |
let wethBalance | |
let usdcBalance | |
wethBalance = await wethContract.balanceOf(signerAddress) | |
usdcBalance = await usdcContract.balanceOf(signerAddress) | |
console.log('================= BEFORE SWAP') | |
console.log('wethBalance:', hardhat.ethers.utils.formatUnits(wethBalance.toString(), 18)) | |
console.log('usdcBalance:', hardhat.ethers.utils.formatUnits(usdcBalance.toString(), 6)) | |
const tx = await smartRouterContract.connect(signer).exactInputSingle( | |
params, | |
{ | |
gasLimit: hardhat.ethers.utils.hexlify(1000000) | |
} | |
); | |
await tx.wait() | |
wethBalance = await wethContract.balanceOf(signerAddress) | |
usdcBalance = await usdcContract.balanceOf(signerAddress) | |
console.log('================= AFTER SWAP') | |
console.log('wethBalance:', hardhat.ethers.utils.formatUnits(wethBalance.toString(), 18)) | |
console.log('usdcBalance:', hardhat.ethers.utils.formatUnits(usdcBalance.toString(), 6)) | |
} | |
/* | |
node scripts/01_swap.js | |
*/ | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment