I am practicing using the uniswap v3 router and i created a simple contract that attempts to swap a certain amount of ETH to dai. This is the function that does so
function convertETHToDAI() external payable {
require(msg.value > 0, "You must send ETH");
uint256 deadline = block.timestamp + 15; // using 'now' for convenience, for mainnet pass deadline from frontend!
address tokenIn = WETH9;
address tokenOut = multiDaiKovan;
uint24 fee = 3000;
address recipient = msg.sender;
uint256 amountIn = msg.value;
uint256 amountOutMinimum = 1;
uint160 sqrtPriceLimitX96 = 0;
ISwapRouter.ExactOutputSingleParams memory params = ISwapRouter.ExactOutputSingleParams(tokenIn,
tokenOut,
fee,
recipient,
deadline,
amountIn,
amountOutMinimum,
sqrtPriceLimitX96);
uniswap = IUniSwapRouter(UniswapAddress);
uniswap.exactOutputSingle{value: msg.value}(params);
uniswap.refundETH();
(bool success, ) = msg.sender.call{value: address(this).balance }("");
require(success, "Refund to caller failed");
}
I deploy it successfully to the rinkeby test network and try to call it and send ether with the truffle console and all i get is the
evalmachine.:1 await engine.convertETHToDAI{value: 0.1 ether}() ^
Uncaught SyntaxError: Unexpected token '{'
error shown in the image.
I am certain i am doing something wrong but i dont know what.