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

Feature/swaps via call #29

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
34072f9
del DexType enum and add dexRouter
AleksiGer Nov 18, 2024
c5d248c
natspec
AleksiGer Nov 18, 2024
9cbdc29
add InsufficientAmount error
AleksiGer Nov 18, 2024
9b3f94f
add additional after swap check
AleksiGer Nov 18, 2024
6e9d021
implement _performSwap fn
AleksiGer Nov 18, 2024
e924f8d
delete unused param
AleksiGer Nov 18, 2024
1a3b71f
add receiving tokens by the user
AleksiGer Nov 18, 2024
f85c295
delete unused
AleksiGer Nov 18, 2024
d38fd96
add new tokens
AleksiGer Nov 21, 2024
3ecfbd7
add args in forks
AleksiGer Nov 21, 2024
b6f43f2
add tests for DexSwap
AleksiGer Nov 21, 2024
f654b9a
delete useless checks and calls
AleksiGer Nov 21, 2024
aa5cbe6
add new tokens
AleksiGer Nov 22, 2024
5d42039
add avalanche fork
AleksiGer Nov 22, 2024
f25392e
add polygon & avalanche tests
AleksiGer Nov 22, 2024
eb1b154
add forks and funcs for them
AleksiGer Nov 22, 2024
47ab350
optimize comparison
AleksiGer Nov 29, 2024
980bc7e
optimize conditions
AleksiGer Nov 29, 2024
0f85554
delete comments and unused imports
AleksiGer Nov 29, 2024
dd5b309
delete abicoder v2 because it already presents since 0.8.0
AleksiGer Nov 29, 2024
b150278
Merge branch 'master' into feature/swaps-via-call
lufaque Dec 15, 2024
2757f1a
fix naming issues
lufaque Dec 15, 2024
543ec88
new test suit base
lufaque Dec 16, 2024
11d1b13
uni v3 test
lufaque Dec 16, 2024
36249f5
add view
AleksiGer Dec 16, 2024
3c2077e
update naming
lufaque Dec 17, 2024
4538e9f
update dex swap, add univ3 and sushi swap tests
lufaque Dec 17, 2024
07eeb59
fix typo
AleksiGer Dec 17, 2024
69e58cc
update dex swap, add univ3 and sushi swap tests
lufaque Dec 17, 2024
ea28efc
Merge remote-tracking branch 'origin/feature/swaps-via-call' into fea…
lufaque Dec 17, 2024
23870e5
sushi swap, uniswap tests
lufaque Dec 17, 2024
0eeda0f
uni, quickswap and alienbase tests
AleksiGer Dec 17, 2024
489a2ef
add polygon, avalanche, optimism
AleksiGer Dec 17, 2024
4039e8d
Merge branch 'feature/swaps-via-call' of https://github.com/concero/c…
AleksiGer Dec 17, 2024
84e84ba
reorder tests and fix name
AleksiGer Dec 17, 2024
5dff768
remove comments
lufaque Dec 18, 2024
a41d35f
fix env names
lufaque Dec 18, 2024
01737df
remove unused imports
lufaque Dec 18, 2024
7298656
reformat label
AleksiGer Dec 18, 2024
5f31617
Merge branch 'feature/swaps-via-call' of https://github.com/concero/c…
AleksiGer Dec 18, 2024
6767f77
setup solhint
lufaque Dec 20, 2024
3a654d4
Merge remote-tracking branch 'origin/feature/swaps-via-call' into fea…
lufaque Dec 20, 2024
6f6634e
update set contracts task
lufaque Dec 23, 2024
e194fe9
rename dexData to dexCallData
AleksiGer Dec 23, 2024
178e2bc
Merge branch 'feature/swaps-via-call' of https://github.com/concero/c…
AleksiGer Dec 23, 2024
83ce309
rename dexData to dexCallData
AleksiGer Dec 23, 2024
338da27
add tokens
AleksiGer Dec 25, 2024
f929cfb
add wrapped to whitelist
AleksiGer Dec 25, 2024
bf18749
add new tests for native and wrapped
AleksiGer Dec 25, 2024
7fc08cb
update deploy dex swap script
lufaque Dec 25, 2024
14a17d8
add pangolin
AleksiGer Dec 26, 2024
598bc34
add tests for pangolin avalanche
AleksiGer Dec 26, 2024
69f323d
rename
AleksiGer Dec 26, 2024
388c972
Merge branch 'feature/swaps-via-call' of https://github.com/concero/c…
AleksiGer Dec 26, 2024
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
21 changes: 21 additions & 0 deletions .env.clccip
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,24 @@ UNISWAP_ROUTER_OPTIMISM=0xE592427A0AEce92De3Edee1F18E0157C05861564
UNISWAP_ROUTER_POLYGON=0xE592427A0AEce92De3Edee1F18E0157C05861564
UNISWAP_ROUTER_ARBITRUM=0xE592427A0AEce92De3Edee1F18E0157C05861564
UNISWAP_ROUTER_AVALANCHE=0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE
UNI_V3_ROUTER02_BASE=0x2626664c2603336E57B271c5C0b26F421741e481
UNI_V3_ROUTER_ARBITRUM=0xE592427A0AEce92De3Edee1F18E0157C05861564

# SUSHISWAP ROUTERS
SUSHISWAP_ROUTER_ARBITRUM=0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506
SUSHISWAP_ROUTER_BASE=0x6BDED42c6DA8FBf0d2bA55B2fa120C5e0c8D7891

# QUICKSWAP ROUTERS
QUICKSWAP_ROUTER_POLYGON=0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff

# ODOS
ODOS_ROUTER_V2_BASE=0x19cEeAd7105607Cd444F5ad10dd51356436095a1

# ALIENBASE
ALIENBASE_ROUTER_BASE=0x8c1A3cF8f83074169FE5D7aD50B978e1cD6b37c7

# CURVE
CURVE_ROUTER_BASE=0xd6681e74eEA20d196c15038C580f721EF2aB6320

# PANGOLIN
PANGOLIN_ROUTER_AVALANCHE=0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106
24 changes: 24 additions & 0 deletions .env.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ USDC_POLYGON=0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359
USDC_AVALANCHE=0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E
USDC_BASE=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

# USDT MAINNET
USDT_ARBITRUM=0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9

# WETH MAINNET
WETH_BASE=0x4200000000000000000000000000000000000006
WETH_ARBITRUM=0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
WETH_POLYGON=0x7ceb23fd6bc0add59e62ac25578270cff1b9f619
WETH_OPTIMISM=0x4200000000000000000000000000000000000006

# WPOL/WMATIC MAINNET
WPOL_POLYGON=0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270

# WAVAX MAINNET
WAVAX_AVALANCHE=0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7

# DAI MAINNET
DAI_BASE=0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb

# SUSHI MAINNET
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this sushi dex or sushi token?

SUSHI_BASE=0x7d49a065d17d6d4a55dc13649901fdbb98b2afba

# 1INCH TOKEN MAINNET
1INCH_BASE=0xc5fecC3a29Fb57B5024eEc8a2239d4621e111CBE

# USDC TESTNET
USDC_SEPOLIA=0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238
USDC_ARBITRUM_SEPOLIA=0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d
Expand Down
39 changes: 11 additions & 28 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,34 @@
{
"extends": "solhint:recommended",
"plugins": [
"chainlink-solidity"
],
"plugins": ["chainlink-solidity"],
"rules": {
"prettier/prettier": "error",
"no-unused-vars": "error",
"contract-name-camelcase": "error",
"event-name-camelcase": "error",
"func-name-mixedcase": "error",
"func-param-name-mixedcase": "error",
"modifier-name-mixedcase": "error",
"imports-on-top": "error",
"compiler-version": [
"off",
"^0.8.20"
],
"compiler-version": ["off", "^0.8.0"],
"const-name-snakecase": "off",
"constructor-syntax": "error",
"var-name-mixedcase": "off",
"avoid-low-level-calls": "off",
"chainlink-solidity/no-block-single-if-reverts": "off",
"no-inline-assembly": "off",
"func-visibility": [
"error",
{
"ignoreConstructors": true
}
],
"max-line-length": [
"error",
160
],
"not-rely-on-time": "off",
"no-empty-blocks": "warn",
"quotes": [
"error",
"double"
],
"no-empty-blocks": "off",
"reason-string": [
"warn",
{
"maxLength": 64
}
],
"named-return-values": "off",
"chainlink-solidity/prefix-internal-functions-with-underscore": "warn",
"chainlink-solidity/prefix-private-functions-with-underscore": "warn",
"chainlink-solidity/inherited-constructor-args-not-in-contract-definition": "warn",
"chainlink-solidity/no-block-single-if-reverts": "off",
"chainlink-solidity/explicit-returns": "warn"
"chainlink-solidity/prefix-storage-variables-with-s-underscore": "warn",
"chainlink-solidity/prefix-immutable-variables-with-i": "warn",
"chainlink-solidity/all-caps-constant-storage-variables": "warn",
"chainlink-solidity/no-hardhat-imports": "warn",
"chainlink-solidity/inherited-constructor-args-not-in-contract-definition": "warn"
}
}
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
# - `make test` : Run all tests using forge with any optional arguments specified in --args.
# For example: `make test args="--match-test Deposit"`

include .env.foundry
include ./.env
include ./.env.tokens
include ./.env.clccip
include ./.env.clf
include ./.env.deployments.mainnet
include ./.env.deployments.testnet
include ./.env.wallets
include .env.foundry

ENV_FILES := .env.foundry ./.env ./.env.tokens ./.env.clccip ./.env.clf ./.env.deployments.mainnet ./.env.deployments.testnet ./.env.wallets
ENV_FILES := ./.env ./.env.tokens ./.env.clccip ./.env.clf ./.env.deployments.mainnet ./.env.deployments.testnet ./.env.wallets .env.foundry
export $(shell cat $(ENV_FILES) | sed 's/=.*//' | sort | uniq)
args =

Expand All @@ -30,10 +30,16 @@ install:
grep -E '^\s*url' ./.gitmodules | awk '{print $$3}' | xargs -I {} sh -c 'forge install {}'

run_fork:
anvil --fork-url ${BASE_RPC_URL} -p ${BASE_LOCAL_FORK_PORT}
anvil --fork-url ${BASE_RPC_URL} -p ${BASE_LOCAL_FORK_PORT} $(args)

run_arb_fork:
anvil --fork-url ${ARB_RPC_URL} -p ${ARB_LOCAL_FORK_PORT}
anvil --fork-url ${ARB_RPC_URL} -p ${ARB_LOCAL_FORK_PORT} $(args)

run_polygon_fork:
anvil --fork-url ${POLYGON_RPC_URL} -p ${POLYGON_LOCAL_FORK_PORT} $(args)

run_avalanche_fork:
anvil --fork-url ${AVALANCHE_RPC_URL} -p ${AVALANCHE_LOCAL_FORK_PORT} $(args)

test:
forge test $(args)
Expand Down
7 changes: 1 addition & 6 deletions constants/rpcUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ export const urls: Record<string, string[]> = {
`https://avalanche-fuji.core.chainstack.com/ext/bc/C/rpc/${CHAINSTACK_API_KEY}`,
`https://ava-testnet.blastapi.io/${BLAST_API_KEY}ext/bc/C/rpc`,
],
arbitrum: [
`https://lb.drpc.org/ogrpc?network=arbitrum&dkey=${DRPC_API_KEY}`,
`https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}`,
`https://arbitrum-one.blastapi.io/${BLAST_API_KEY}`,
"https://rpc.ankr.com/arbitrum",
],
arbitrum: ["https://rpc.ankr.com/arbitrum", "https://arbitrum-one-rpc.publicnode.com"],
arbitrumSepolia: [
`https://lb.drpc.org/ogrpc?network=arbitrum-sepolia&dkey=${DRPC_API_KEY}`,
`https://arbitrum-sepolia.infura.io/v3/${INFURA_API_KEY}`,
Expand Down
1 change: 0 additions & 1 deletion contracts/ConceroBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {InfraCCIP} from "./InfraCCIP.sol";
import {IConceroBridge} from "./Interfaces/IConceroBridge.sol";
import {IInfraStorage} from "./Interfaces/IInfraStorage.sol";

/* ERRORS */
///@notice error emitted when the input amount is less than the fees
Expand Down
Loading
Loading