Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change memory to calldata to save gas #158

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contracts/UniswapV2Router01.sol
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ contract UniswapV2Router01 is IUniswapV2Router01 {
return UniswapV2Library.getAmountOut(amountOut, reserveIn, reserveOut);
}

function getAmountsOut(uint amountIn, address[] memory path) public view override returns (uint[] memory amounts) {
function getAmountsOut(uint amountIn, address[] calldata path) public view override returns (uint[] memory amounts) {
return UniswapV2Library.getAmountsOut(factory, amountIn, path);
}

function getAmountsIn(uint amountOut, address[] memory path) public view override returns (uint[] memory amounts) {
function getAmountsIn(uint amountOut, address[] calldata path) public view override returns (uint[] memory amounts) {
return UniswapV2Library.getAmountsIn(factory, amountOut, path);
}
}
4 changes: 2 additions & 2 deletions contracts/UniswapV2Router02.sol
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ contract UniswapV2Router02 is IUniswapV2Router02 {
return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);
}

function getAmountsOut(uint amountIn, address[] memory path)
function getAmountsOut(uint amountIn, address[] calldata path)
public
view
virtual
Expand All @@ -434,7 +434,7 @@ contract UniswapV2Router02 is IUniswapV2Router02 {
return UniswapV2Library.getAmountsOut(factory, amountIn, path);
}

function getAmountsIn(uint amountOut, address[] memory path)
function getAmountsIn(uint amountOut, address[] calldata path)
public
view
virtual
Expand Down