Skip to content

uniswapv3 amm adapter #10

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

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ce0add3
init files
zishansami102 Jul 12, 2022
10cde65
arrakis uniV3 adapter contract draft-1
zishansami102 Jul 15, 2022
b02754f
contract typos fix
zishansami102 Jul 17, 2022
3aa13c7
add arrakis abis, fixtures, and constructor tests
zishansami102 Jul 17, 2022
6f096a1
add test for getSpenderAddress
zishansami102 Jul 17, 2022
831a0b1
typo fix
zishansami102 Jul 18, 2022
4193b04
GUniPool to ArrakisVaultV1
zishansami102 Jul 18, 2022
0b475d5
add isValidPool tests
zishansami102 Jul 19, 2022
c88ecd5
add tests for singleAssetCalldata functions
zishansami102 Jul 19, 2022
44a940a
add more unit tests
zishansami102 Jul 19, 2022
755137f
add integration tests
zishansami102 Jul 21, 2022
375cd81
review fixes
zishansami102 Jul 21, 2022
206a476
review fixes
zishansami102 Jul 27, 2022
36f9257
Merge remote-tracking branch 'edward_set2/zishan/uniswapv3-amm-adapte…
snake-poison Feb 6, 2023
3e4cfe1
chore: enabled 0.8.17 solidity compiler
snake-poison Feb 6, 2023
be7d93e
refactor: widens type of IERC20 to address
snake-poison Feb 6, 2023
7c55055
ref: removes unused safemath library.
snake-poison Feb 6, 2023
7d44cf2
style: update feature spdx identifiers.
snake-poison Feb 6, 2023
a016dbb
ref: update feature solidity pragma to 0.8.17
snake-poison Feb 6, 2023
5e51ada
ref: fix warnings for visibility state mutability.
snake-poison Feb 6, 2023
6a7bb40
style: formatted spec file with prettier eslint
snake-poison Feb 8, 2023
18de1cf
feat(test): invalid constructor args.
snake-poison Feb 8, 2023
3a0acb8
test: adds missing branch in isvalid
snake-poison Feb 8, 2023
2b65b92
chore: adds hardhat-network-helpers as dev dep.
snake-poison Feb 9, 2023
ba5e4ce
test: reset fork to blocknumber in config
snake-poison Feb 9, 2023
aa6728f
chore: upgraded some devdeps
snake-poison Feb 11, 2023
5f789f3
test: more strict revert strings
snake-poison Feb 11, 2023
6aadea0
chore: setup smock dep dev.
snake-poison Feb 13, 2023
f2a1145
test: added case for an invalid pool
snake-poison Feb 13, 2023
570b65f
style: doc string edits.
snake-poison Feb 13, 2023
6982692
chore: adds ext interface for arrakis v1 router.
snake-poison Feb 13, 2023
4663019
refactor: no copy to memory and encodewithcall
snake-poison Feb 13, 2023
1df82d0
chore: compiling viaIR for 0.8 contracts.
snake-poison Feb 13, 2023
de8d270
test: sets expected calldata to match v1 router.
snake-poison Mar 13, 2023
bfb9d68
fix: fix import line to grab all exports.
snake-poison Mar 13, 2023
eec32a1
chore: setup hardhat to emi yul properly
snake-poison Mar 13, 2023
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/interfaces/IAmmAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache License, Version 2.0
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.10;
pragma solidity >=0.6.10 < 0.9;


/**
Expand Down
148 changes: 148 additions & 0 deletions contracts/interfaces/external/IArrakisRouterV1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/*
Copyright 2023 Index Coop.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache-2.0
*/

pragma solidity >=0.6.10 < 0.9;


import {
IArrakisVaultV1
} from "./IArrakisVaultV1.sol";

interface IArrakisRouterV1 {
function addLiquidity(
IArrakisVaultV1 pool,
uint256 amount0Max,
uint256 amount1Max,
uint256 amount0Min,
uint256 amount1Min,
uint256 amountSharesMin,
address receiver
)
external
returns (
uint256 amount0,
uint256 amount1,
uint256 mintAmount
);

function addLiquidityETH(
IArrakisVaultV1 pool,
uint256 amount0Max,
uint256 amount1Max,
uint256 amount0Min,
uint256 amount1Min,
uint256 amountSharesMin,
address receiver
)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 mintAmount
);

function addLiquidityAndStake(
address gauge,
uint256 amount0Max,
uint256 amount1Max,
uint256 amount0Min,
uint256 amount1Min,
uint256 amountSharesMin,
address receiver
)
external
returns (
uint256 amount0,
uint256 amount1,
uint256 mintAmount
);

function addLiquidityETHAndStake(
address gauge,
uint256 amount0Max,
uint256 amount1Max,
uint256 amount0Min,
uint256 amount1Min,
uint256 amountSharesMin,
address receiver
)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 mintAmount
);

function removeLiquidity(
IArrakisVaultV1 pool,
uint256 burnAmount,
uint256 amount0Min,
uint256 amount1Min,
address receiver
)
external
returns (
uint256 amount0,
uint256 amount1,
uint128 liquidityBurned
);

function removeLiquidityETH(
IArrakisVaultV1 pool,
uint256 burnAmount,
uint256 amount0Min,
uint256 amount1Min,
address payable receiver
)
external
returns (
uint256 amount0,
uint256 amount1,
uint128 liquidityBurned
);

function removeLiquidityAndUnstake(
address gauge,
uint256 burnAmount,
uint256 amount0Min,
uint256 amount1Min,
address receiver
)
external
returns (
uint256 amount0,
uint256 amount1,
uint128 liquidityBurned
);

function removeLiquidityETHAndUnstake(
address gauge,
uint256 burnAmount,
uint256 amount0Min,
uint256 amount1Min,
address payable receiver
)
external
returns (
uint256 amount0,
uint256 amount1,
uint128 liquidityBurned
);
}
87 changes: 87 additions & 0 deletions contracts/interfaces/external/IArrakisVaultV1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
Copyright 2023 Index Coop.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache-2.0
*/

pragma solidity >=0.6.10 < 0.9;


import {
IUniswapV3Pool
} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";

interface IArrakisVaultV1 {
function mint(uint256 mintAmount, address receiver)
external
returns (
uint256 amount0,
uint256 amount1,
uint128 liquidityMinted
);

function burn(uint256 burnAmount, address receiver)
external
returns (
uint256 amount0,
uint256 amount1,
uint128 liquidityBurned
);

function getMintAmounts(uint256 amount0Max, uint256 amount1Max)
external
view
returns (
uint256 amount0,
uint256 amount1,
uint256 mintAmount
);

function getUnderlyingBalances()
external
view
returns (uint256 amount0, uint256 amount1);

function getUnderlyingBalancesAtPrice(uint160 sqrtRatioX96)
external
view
returns (uint256 amount0Current, uint256 amount1Current);

function getPositionID() external view returns (bytes32 positionID);

function token0() external view returns (address);

function token1() external view returns (address);

function upperTick() external view returns (int24);

function lowerTick() external view returns (int24);

function pool() external view returns (IUniswapV3Pool);

function totalSupply() external view returns (uint256);

function balanceOf(address account) external view returns (uint256);

function executiveRebalance(
int24 newLowerTick,
int24 newUpperTick,
uint160 swapThresholdPrice,
uint256 swapAmountBPS,
bool zeroForOne
) external;

function withdrawManagerBalance() external;
}
Loading