Compare commits

...

7 Commits

Author SHA1 Message Date
Marcin Wolny
39c77560a1 Invalid caching configuration 2022-09-20 15:45:26 +02:00
Savarn Dontamsetti
85905d5f19 fixing CI: ganache tests 2022-09-19 17:12:24 -04:00
Savarn Dontamsetti
e85ce9eb8f updating imports 2022-09-19 16:38:49 -04:00
Savarn Dontamsetti
0e29459c60 remvoing DODO V1 from Arbitrum Bridge Adapter 2022-09-19 16:37:55 -04:00
Noah Khamliche
43a705f41e remove duplicate DODOV2 2022-09-12 14:36:47 -04:00
Noah Khamliche
bffb064649 refactor bridgeAdapter to include currently deployed changes 2022-09-12 14:08:17 -04:00
Savarn Dontamsetti
846796ad36 adding Nerve Mixin to Arbitrum Bridge Adapter 2022-09-12 13:54:58 -04:00
3 changed files with 72 additions and 24 deletions

View File

@@ -3,7 +3,7 @@ version: 2.1
parameters:
cache_version:
type: string
default: v4
default: v5
jobs:
build:
@@ -33,46 +33,46 @@ jobs:
- save_cache:
key: cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
paths:
- ~/project/contracts/erc20/node_modules
- ~/project/contracts/test-utils/node_modules
- ~/project/contracts/treasury/node_modules
- ~/project/contracts/utils/node_modules
- ~/project/contracts/zero-ex/node_modules
- ~/project/node_modules
- ~/project/packages/asset-swapper/node_modules
- ~/project/packages/contract-addresses/node_modules
- ~/project/packages/contract-artifacts/node_modules
- ~/project/packages/contract-wrappers/node_modules
- ~/project/packages/protocol-utils/node_modules
- ~/.cache/yarn
- save_cache:
key: lib-{{ .Environment.CIRCLE_BRANCH }}
key: lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
paths:
- ~/project/contracts/erc20/generated-artifacts/
- ~/project/contracts/erc20/generated-wrappers/
- ~/project/contracts/erc20/lib/
- ~/project/contracts/erc20/node_modules
- ~/project/contracts/erc20/test/generated-artifacts/
- ~/project/contracts/erc20/test/generated-wrappers/
- ~/project/contracts/test-utils/lib/
- ~/project/contracts/test-utils/node_modules
- ~/project/contracts/treasury/generated-artifacts/
- ~/project/contracts/treasury/generated-wrappers/
- ~/project/contracts/treasury/lib/
- ~/project/contracts/treasury/node_modules
- ~/project/contracts/treasury/test/generated-artifacts/
- ~/project/contracts/treasury/test/generated-wrappers/
- ~/project/contracts/utils/generated-artifacts/
- ~/project/contracts/utils/generated-wrappers/
- ~/project/contracts/utils/lib/
- ~/project/contracts/utils/node_modules
- ~/project/contracts/utils/test/generated-artifacts/
- ~/project/contracts/utils/test/generated-wrappers/
- ~/project/contracts/zero-ex/generated-artifacts/
- ~/project/contracts/zero-ex/generated-wrappers/
- ~/project/contracts/zero-ex/lib/
- ~/project/contracts/zero-ex/node_modules
- ~/project/contracts/zero-ex/test/generated-artifacts/
- ~/project/contracts/zero-ex/test/generated-wrappers/
- ~/project/packages/asset-swapper/node_modules
- ~/project/packages/contract-addresses/lib/
- ~/project/packages/contract-addresses/node_modules
- ~/project/packages/contract-artifacts/lib/
- ~/project/packages/contract-artifacts/node_modules
- ~/project/packages/contract-wrappers/lib/
- ~/project/packages/contract-wrappers/node_modules
- ~/project/packages/protocol-utils/lib/
- ~/project/packages/protocol-utils/node_modules
- store_artifacts:
path: ~/repo/packages/abi-gen/test-cli/output
- store_artifacts:
@@ -88,7 +88,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci
test-integrations-ganache:
resource_class: xlarge
@@ -101,7 +101,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci
test-contracts-staking-ganache:
resource_class: xlarge
@@ -112,7 +112,7 @@ jobs:
- restore_cache:
keys:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci
test-contracts-extra-ganache:
resource_class: xlarge
@@ -125,7 +125,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci
test-contracts-rest-ganache:
resource_class: xlarge
@@ -143,7 +143,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: |
yarn wsrun \
-p @0x/contracts-multisig \
@@ -173,7 +173,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: git submodule update --init --recursive
- run:
command: forge test
@@ -198,7 +198,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run:
command: yarn test:publish:circleci
no_output_timeout: 1800
@@ -214,7 +214,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run:
command: yarn test:generate_docs:circleci
no_output_timeout: 1200
@@ -230,7 +230,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci
- run: yarn wsrun -p @0x/contract-addresses -m --serial -c test:circleci
- run: yarn wsrun -p @0x/contract-artifacts -m --serial -c test:circleci
@@ -257,7 +257,10 @@ jobs:
- restore_cache:
keys:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run:
command: yarn lerna run lint
- run:
@@ -275,7 +278,7 @@ jobs:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- coverage-contract-wrappers-test-{{ checksum "yarn.lock" }}

View File

@@ -23,19 +23,29 @@ pragma experimental ABIEncoderV2;
import "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinBalancerV2.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinDodoV2.sol";
import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinGMX.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinZeroExBridge.sol";
contract ArbitrumBridgeAdapter is
AbstractBridgeAdapter(42161, "Arbitrum"),
MixinBalancerV2,
MixinBalancerV2Batch,
MixinCurve,
MixinCurveV2,
MixinDodoV2,
MixinKyberDmm,
MixinGMX,
MixinNerve,
MixinUniswapV3,
MixinUniswapV2,
MixinZeroExBridge
{
constructor(IEtherTokenV06 weth)
@@ -63,6 +73,12 @@ contract ArbitrumBridgeAdapter is
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeBalancerV2Batch(
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.CURVE) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeCurve(
@@ -71,6 +87,14 @@ contract ArbitrumBridgeAdapter is
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.CURVEV2) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeCurveV2(
sellToken,
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.DODOV2) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeDodoV2(
@@ -78,6 +102,13 @@ contract ArbitrumBridgeAdapter is
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.KYBERDMM) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeKyberDmm(
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeUniswapV3(
@@ -85,9 +116,23 @@ contract ArbitrumBridgeAdapter is
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeUniswapV2(
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.GMX) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeGMX(
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.NERVE) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeNerve(
sellToken,
sellAmount,
order.bridgeData

View File

@@ -105,8 +105,8 @@ export enum FillQuoteTransformerSide {
export enum FillQuoteTransformerOrderType {
Bridge,
Limit,
Otc,
Rfq,
Otc,
}
/**