function buy(uint amountIn,uint amountOut,address token_address) external isOwner{
address[] memory path = new address[](2);
path[0] = address(0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd);
path[1] = address(token_address);
Irouter(0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3).swapExactTokensForTokens(amountIn,amountOut,path,address(this),block.timestamp+15);
}
这是我写的购买token的函数,调用时要花费13万gas,但我观察到像1inch的交换只花费了11万gas,还有的合约只花费10万gas左右,这里还有更底层节约gas的相关方法吗,他们是如何实现节约gas的?比如调用pair合约的swap
方法实现?