How can I delegate call from a contract to pancakeswap v3 router for exactInput using abi.encodeWithSignature. I am having a problem sending it to the router here is the code
function exactInputSingle(address token0, address token1, uint256 amountIn, uint24 fee, address recipient)
external pure returns (bytes memory){
<code>ExactInputSingleParams memory exactInputSingleParams = ExactInputSingleParams({
tokenIn : token0,
tokenOut : token1,
fee : fee,
recipient : recipient,
amountIn : amountIn,
amountOutMinimum : 0,
sqrtPriceLimitX96 : 0
});
return abi.encodeWithSignature("exactInputSingle(ExactInputSingleParams)", exactInputSingleParams);
}
</code>
<code>ExactInputSingleParams memory exactInputSingleParams = ExactInputSingleParams({
tokenIn : token0,
tokenOut : token1,
fee : fee,
recipient : recipient,
amountIn : amountIn,
amountOutMinimum : 0,
sqrtPriceLimitX96 : 0
});
return abi.encodeWithSignature("exactInputSingle(ExactInputSingleParams)", exactInputSingleParams);
}
</code>
ExactInputSingleParams memory exactInputSingleParams = ExactInputSingleParams({
tokenIn : token0,
tokenOut : token1,
fee : fee,
recipient : recipient,
amountIn : amountIn,
amountOutMinimum : 0,
sqrtPriceLimitX96 : 0
});
return abi.encodeWithSignature("exactInputSingle(ExactInputSingleParams)", exactInputSingleParams);
}
New contributor
Hafiz Hamza Javed is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.