Compare commits
4 Commits
developmen
...
josh/bridg
Author | SHA1 | Date | |
---|---|---|---|
|
73fea831da | ||
|
26cdbabe86 | ||
|
09524e9740 | ||
|
c22a08de32 |
@ -110,16 +110,11 @@
|
|||||||
"./contracts/src/transformers/Transformer.sol",
|
"./contracts/src/transformers/Transformer.sol",
|
||||||
"./contracts/src/transformers/WethTransformer.sol",
|
"./contracts/src/transformers/WethTransformer.sol",
|
||||||
"./contracts/src/transformers/bridges/AbstractBridgeAdapter.sol",
|
"./contracts/src/transformers/bridges/AbstractBridgeAdapter.sol",
|
||||||
"./contracts/src/transformers/bridges/ArbitrumBridgeAdapter.sol",
|
"./contracts/src/transformers/bridges/BridgeAdapter.sol",
|
||||||
"./contracts/src/transformers/bridges/AvalancheBridgeAdapter.sol",
|
"./contracts/src/transformers/bridges/BridgeAdapterGroup1.sol",
|
||||||
"./contracts/src/transformers/bridges/BSCBridgeAdapter.sol",
|
"./contracts/src/transformers/bridges/BridgeAdapterGroup2.sol",
|
||||||
"./contracts/src/transformers/bridges/BridgeProtocols.sol",
|
"./contracts/src/transformers/bridges/BridgeProtocols.sol",
|
||||||
"./contracts/src/transformers/bridges/CeloBridgeAdapter.sol",
|
|
||||||
"./contracts/src/transformers/bridges/EthereumBridgeAdapter.sol",
|
|
||||||
"./contracts/src/transformers/bridges/FantomBridgeAdapter.sol",
|
|
||||||
"./contracts/src/transformers/bridges/IBridgeAdapter.sol",
|
"./contracts/src/transformers/bridges/IBridgeAdapter.sol",
|
||||||
"./contracts/src/transformers/bridges/OptimismBridgeAdapter.sol",
|
|
||||||
"./contracts/src/transformers/bridges/PolygonBridgeAdapter.sol",
|
|
||||||
"./contracts/src/transformers/bridges/mixins/MixinAaveV2.sol",
|
"./contracts/src/transformers/bridges/mixins/MixinAaveV2.sol",
|
||||||
"./contracts/src/transformers/bridges/mixins/MixinBalancer.sol",
|
"./contracts/src/transformers/bridges/mixins/MixinBalancer.sol",
|
||||||
"./contracts/src/transformers/bridges/mixins/MixinBalancerV2Batch.sol",
|
"./contracts/src/transformers/bridges/mixins/MixinBalancerV2Batch.sol",
|
||||||
|
@ -18,22 +18,6 @@ pragma experimental ABIEncoderV2;
|
|||||||
import "./IBridgeAdapter.sol";
|
import "./IBridgeAdapter.sol";
|
||||||
|
|
||||||
abstract contract AbstractBridgeAdapter is IBridgeAdapter {
|
abstract contract AbstractBridgeAdapter is IBridgeAdapter {
|
||||||
constructor(uint256 expectedChainId, string memory expectedChainName) public {
|
|
||||||
uint256 chainId;
|
|
||||||
assembly {
|
|
||||||
chainId := chainid()
|
|
||||||
}
|
|
||||||
// Skip chain id validation on Ganache (1337), Anvil (31337), Goerli (5), Mumbai (80001), Base Goerli (84531)
|
|
||||||
bool skipValidation = (chainId == 1337 ||
|
|
||||||
chainId == 31337 ||
|
|
||||||
chainId == 5 ||
|
|
||||||
chainId == 80001 ||
|
|
||||||
chainId == 84531);
|
|
||||||
|
|
||||||
if (chainId != expectedChainId && !skipValidation) {
|
|
||||||
revert(string(abi.encodePacked(expectedChainName, "BridgeAdapter.constructor: wrong chain ID")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isSupportedSource(bytes32 source) external override returns (bool isSupported) {
|
function isSupportedSource(bytes32 source) external override returns (bool isSupported) {
|
||||||
BridgeOrder memory placeholderOrder;
|
BridgeOrder memory placeholderOrder;
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
/*
|
|
||||||
Copyright 2023 ZeroEx Intl.
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pragma solidity ^0.6.5;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
import "./AbstractBridgeAdapter.sol";
|
|
||||||
import "./BridgeProtocols.sol";
|
|
||||||
import "./mixins/MixinAaveV3.sol";
|
|
||||||
import "./mixins/MixinBalancerV2Batch.sol";
|
|
||||||
import "./mixins/MixinCurve.sol";
|
|
||||||
import "./mixins/MixinCurveV2.sol";
|
|
||||||
import "./mixins/MixinDodoV2.sol";
|
|
||||||
import "./mixins/MixinKyberDmm.sol";
|
|
||||||
import "./mixins/MixinKyberElastic.sol";
|
|
||||||
import "./mixins/MixinGMX.sol";
|
|
||||||
import "./mixins/MixinNerve.sol";
|
|
||||||
import "./mixins/MixinUniswapV3.sol";
|
|
||||||
import "./mixins/MixinUniswapV2.sol";
|
|
||||||
import "./mixins/MixinWOOFi.sol";
|
|
||||||
import "./mixins/MixinZeroExBridge.sol";
|
|
||||||
|
|
||||||
contract ArbitrumBridgeAdapter is
|
|
||||||
AbstractBridgeAdapter(42161, "Arbitrum"),
|
|
||||||
MixinAaveV3,
|
|
||||||
MixinBalancerV2Batch,
|
|
||||||
MixinCurve,
|
|
||||||
MixinCurveV2,
|
|
||||||
MixinDodoV2,
|
|
||||||
MixinKyberDmm,
|
|
||||||
MixinKyberElastic,
|
|
||||||
MixinGMX,
|
|
||||||
MixinNerve,
|
|
||||||
MixinUniswapV3,
|
|
||||||
MixinUniswapV2,
|
|
||||||
MixinWOOFi,
|
|
||||||
MixinZeroExBridge
|
|
||||||
{
|
|
||||||
constructor(IEtherToken weth) public MixinCurve(weth) {}
|
|
||||||
|
|
||||||
function _trade(
|
|
||||||
BridgeOrder memory order,
|
|
||||||
IERC20Token sellToken,
|
|
||||||
IERC20Token buyToken,
|
|
||||||
uint256 sellAmount,
|
|
||||||
bool dryRun
|
|
||||||
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
|
||||||
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
|
||||||
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(sellToken, buyToken, 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(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERDMM) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberDmm(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERELASTIC) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV3(sellToken, 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);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNKNOWN) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.AAVEV3) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.WOOFI) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,122 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
/*
|
|
||||||
Copyright 2023 ZeroEx Intl.
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pragma solidity ^0.6.5;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
import "./AbstractBridgeAdapter.sol";
|
|
||||||
import "./BridgeProtocols.sol";
|
|
||||||
import "./mixins/MixinAaveV3.sol";
|
|
||||||
import "./mixins/MixinCurve.sol";
|
|
||||||
import "./mixins/MixinCurveV2.sol";
|
|
||||||
import "./mixins/MixinGMX.sol";
|
|
||||||
import "./mixins/MixinKyberDmm.sol";
|
|
||||||
import "./mixins/MixinKyberElastic.sol";
|
|
||||||
import "./mixins/MixinAaveV2.sol";
|
|
||||||
import "./mixins/MixinNerve.sol";
|
|
||||||
import "./mixins/MixinPlatypus.sol";
|
|
||||||
import "./mixins/MixinUniswapV2.sol";
|
|
||||||
import "./mixins/MixinWOOFi.sol";
|
|
||||||
import "./mixins/MixinZeroExBridge.sol";
|
|
||||||
|
|
||||||
contract AvalancheBridgeAdapter is
|
|
||||||
AbstractBridgeAdapter(43114, "Avalanche"),
|
|
||||||
MixinAaveV3,
|
|
||||||
MixinCurve,
|
|
||||||
MixinCurveV2,
|
|
||||||
MixinGMX,
|
|
||||||
MixinKyberDmm,
|
|
||||||
MixinKyberElastic,
|
|
||||||
MixinAaveV2,
|
|
||||||
MixinNerve,
|
|
||||||
MixinPlatypus,
|
|
||||||
MixinUniswapV2,
|
|
||||||
MixinWOOFi,
|
|
||||||
MixinZeroExBridge
|
|
||||||
{
|
|
||||||
constructor(IEtherToken weth) public MixinCurve(weth) {}
|
|
||||||
|
|
||||||
function _trade(
|
|
||||||
BridgeOrder memory order,
|
|
||||||
IERC20Token sellToken,
|
|
||||||
IERC20Token buyToken,
|
|
||||||
uint256 sellAmount,
|
|
||||||
bool dryRun
|
|
||||||
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
|
||||||
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
|
||||||
if (protocolId == BridgeProtocols.CURVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurve(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.CURVEV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.NERVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERDMM) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberDmm(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERELASTIC) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.AAVEV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeAaveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.GMX) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeGMX(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.PLATYPUS) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradePlatypus(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.WOOFI) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNKNOWN) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.AAVEV3) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
/*
|
|
||||||
Copyright 2023 ZeroEx Intl.
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pragma solidity ^0.6.5;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
import "./AbstractBridgeAdapter.sol";
|
|
||||||
import "./BridgeProtocols.sol";
|
|
||||||
import "./mixins/MixinCurve.sol";
|
|
||||||
import "./mixins/MixinDodo.sol";
|
|
||||||
import "./mixins/MixinDodoV2.sol";
|
|
||||||
import "./mixins/MixinKyberDmm.sol";
|
|
||||||
import "./mixins/MixinKyberElastic.sol";
|
|
||||||
import "./mixins/MixinMooniswap.sol";
|
|
||||||
import "./mixins/MixinNerve.sol";
|
|
||||||
import "./mixins/MixinUniswapV2.sol";
|
|
||||||
import "./mixins/MixinWOOFi.sol";
|
|
||||||
import "./mixins/MixinZeroExBridge.sol";
|
|
||||||
|
|
||||||
contract BSCBridgeAdapter is
|
|
||||||
AbstractBridgeAdapter(56, "BSC"),
|
|
||||||
MixinCurve,
|
|
||||||
MixinDodo,
|
|
||||||
MixinDodoV2,
|
|
||||||
MixinKyberDmm,
|
|
||||||
MixinKyberElastic,
|
|
||||||
MixinMooniswap,
|
|
||||||
MixinNerve,
|
|
||||||
MixinUniswapV2,
|
|
||||||
MixinWOOFi,
|
|
||||||
MixinZeroExBridge
|
|
||||||
{
|
|
||||||
constructor(IEtherToken weth) public MixinCurve(weth) MixinMooniswap(weth) {}
|
|
||||||
|
|
||||||
function _trade(
|
|
||||||
BridgeOrder memory order,
|
|
||||||
IERC20Token sellToken,
|
|
||||||
IERC20Token buyToken,
|
|
||||||
uint256 sellAmount,
|
|
||||||
bool dryRun
|
|
||||||
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
|
||||||
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
|
||||||
if (protocolId == BridgeProtocols.CURVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurve(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.MOONISWAP) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeMooniswap(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.DODO) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeDodo(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.DODOV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeDodoV2(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.NERVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERDMM) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberDmm(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERELASTIC) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.WOOFI) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNKNOWN) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,74 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
/*
|
||||||
|
Copyright 2023 ZeroEx Intl.
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
pragma solidity ^0.6.5;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
import "./IBridgeAdapter.sol";
|
||||||
|
import "./BridgeProtocols.sol";
|
||||||
|
import "./BridgeAdapterGroup1.sol";
|
||||||
|
import "./BridgeAdapterGroup2.sol";
|
||||||
|
|
||||||
|
|
||||||
|
contract BridgeAdapter is IBridgeAdapter {
|
||||||
|
IBridgeAdapter private immutable adapter1;
|
||||||
|
IBridgeAdapter private immutable adapter2;
|
||||||
|
uint256 private constant ADAPTER_1_LAST_PROTOCOL_ID = 26;
|
||||||
|
uint256 private constant ADAPTER_2_LAST_PROTOCOL_ID = 33;
|
||||||
|
|
||||||
|
constructor(IEtherToken weth) public {
|
||||||
|
adapter1 = new BridgeAdapterGroup1(weth);
|
||||||
|
adapter2 = new BridgeAdapterGroup2(weth);
|
||||||
|
}
|
||||||
|
|
||||||
|
function trade(
|
||||||
|
BridgeOrder memory order,
|
||||||
|
IERC20Token sellToken,
|
||||||
|
IERC20Token buyToken,
|
||||||
|
uint256 sellAmount
|
||||||
|
) public override returns (uint256 boughtAmount) {
|
||||||
|
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
||||||
|
|
||||||
|
IBridgeAdapter adapter;
|
||||||
|
if (protocolId <= ADAPTER_1_LAST_PROTOCOL_ID) {
|
||||||
|
adapter = adapter1;
|
||||||
|
} else if (protocolId <= ADAPTER_2_LAST_PROTOCOL_ID) {
|
||||||
|
adapter = adapter2;
|
||||||
|
} else {
|
||||||
|
revert("unknown protocolId");
|
||||||
|
}
|
||||||
|
|
||||||
|
(bool success, bytes memory resultData) = address(adapter).delegatecall(abi.encodeWithSelector(
|
||||||
|
IBridgeAdapter.trade.selector,
|
||||||
|
order,
|
||||||
|
sellToken,
|
||||||
|
buyToken,
|
||||||
|
sellAmount
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (success) {
|
||||||
|
return abi.decode(resultData, (uint256));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSupportedSource(bytes32 source) external override returns (bool isSupported) {
|
||||||
|
uint128 protocolId = uint128(uint256(source) >> 128);
|
||||||
|
if (protocolId <= ADAPTER_1_LAST_PROTOCOL_ID) {
|
||||||
|
return adapter1.isSupportedSource(source);
|
||||||
|
} else if (protocolId <= ADAPTER_2_LAST_PROTOCOL_ID) {
|
||||||
|
return adapter2.isSupportedSource(source);
|
||||||
|
} else {
|
||||||
|
revert("unknown protocolId");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,85 +1,85 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
/*
|
/*
|
||||||
Copyright 2023 ZeroEx Intl.
|
Copyright 2023 ZeroEx Intl.
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pragma solidity ^0.6.5;
|
pragma solidity ^0.6.5;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "./AbstractBridgeAdapter.sol";
|
import "./AbstractBridgeAdapter.sol";
|
||||||
import "./BridgeProtocols.sol";
|
import "./BridgeProtocols.sol";
|
||||||
import "./mixins/MixinAaveV2.sol";
|
import "./mixins/MixinZeroExBridge.sol"; //0
|
||||||
import "./mixins/MixinBalancer.sol";
|
import "./mixins/MixinCurve.sol"; //1
|
||||||
import "./mixins/MixinBalancerV2Batch.sol";
|
import "./mixins/MixinUniswapV2.sol"; //2
|
||||||
import "./mixins/MixinBancor.sol";
|
import "./mixins/MixinUniswap.sol"; //3
|
||||||
import "./mixins/MixinBancorV3.sol";
|
import "./mixins/MixinBalancer.sol"; //4
|
||||||
import "./mixins/MixinCompound.sol";
|
import "./mixins/MixinMooniswap.sol"; //6
|
||||||
import "./mixins/MixinCurve.sol";
|
import "./mixins/MixinMStable.sol"; //7
|
||||||
import "./mixins/MixinCurveV2.sol";
|
import "./mixins/MixinShell.sol"; //9
|
||||||
import "./mixins/MixinCryptoCom.sol";
|
import "./mixins/MixinDodo.sol"; //10
|
||||||
import "./mixins/MixinDodo.sol";
|
import "./mixins/MixinDodoV2.sol"; //11
|
||||||
import "./mixins/MixinDodoV2.sol";
|
import "./mixins/MixinCryptoCom.sol"; //12
|
||||||
import "./mixins/MixinKyberDmm.sol";
|
import "./mixins/MixinBancor.sol"; //13
|
||||||
import "./mixins/MixinKyberElastic.sol";
|
import "./mixins/MixinNerve.sol"; //15
|
||||||
import "./mixins/MixinLido.sol";
|
import "./mixins/MixinMakerPSM.sol"; //16
|
||||||
import "./mixins/MixinMakerPSM.sol";
|
import "./mixins/MixinUniswapV3.sol"; //18
|
||||||
import "./mixins/MixinMStable.sol";
|
import "./mixins/MixinKyberDmm.sol"; //19
|
||||||
import "./mixins/MixinNerve.sol";
|
import "./mixins/MixinCurveV2.sol"; //20
|
||||||
import "./mixins/MixinShell.sol";
|
import "./mixins/MixinLido.sol"; //21
|
||||||
import "./mixins/MixinSynthetix.sol";
|
import "./mixins/MixinAaveV2.sol"; //23
|
||||||
import "./mixins/MixinUniswap.sol";
|
import "./mixins/MixinCompound.sol"; //24
|
||||||
import "./mixins/MixinUniswapV2.sol";
|
import "./mixins/MixinBalancerV2Batch.sol"; //25
|
||||||
import "./mixins/MixinUniswapV3.sol";
|
import "./mixins/MixinGMX.sol"; //26
|
||||||
import "./mixins/MixinZeroExBridge.sol";
|
|
||||||
|
|
||||||
contract EthereumBridgeAdapter is
|
|
||||||
AbstractBridgeAdapter(1, "Ethereum"),
|
|
||||||
MixinAaveV2,
|
contract BridgeAdapterGroup1 is
|
||||||
MixinBalancer,
|
AbstractBridgeAdapter,
|
||||||
MixinBalancerV2Batch,
|
MixinZeroExBridge,
|
||||||
MixinBancor,
|
MixinCurve,
|
||||||
MixinBancorV3,
|
MixinUniswapV2,
|
||||||
MixinCompound,
|
MixinUniswap,
|
||||||
MixinCurve,
|
MixinBalancer,
|
||||||
MixinCurveV2,
|
MixinMooniswap,
|
||||||
MixinCryptoCom,
|
MixinMStable,
|
||||||
MixinDodo,
|
MixinShell,
|
||||||
MixinDodoV2,
|
MixinDodo,
|
||||||
MixinKyberDmm,
|
MixinDodoV2,
|
||||||
MixinKyberElastic,
|
MixinCryptoCom,
|
||||||
MixinLido,
|
MixinBancor,
|
||||||
MixinMakerPSM,
|
MixinNerve,
|
||||||
MixinMStable,
|
MixinMakerPSM,
|
||||||
MixinNerve,
|
MixinUniswapV3,
|
||||||
MixinShell,
|
MixinKyberDmm,
|
||||||
MixinSynthetix,
|
MixinCurveV2,
|
||||||
MixinUniswap,
|
MixinLido,
|
||||||
MixinUniswapV2,
|
MixinAaveV2,
|
||||||
MixinUniswapV3,
|
MixinCompound,
|
||||||
MixinZeroExBridge
|
MixinBalancerV2Batch,
|
||||||
|
MixinGMX
|
||||||
{
|
{
|
||||||
constructor(
|
constructor(
|
||||||
IEtherToken weth
|
IEtherToken weth
|
||||||
)
|
)
|
||||||
public
|
public
|
||||||
MixinBancor(weth)
|
MixinBancor(weth)
|
||||||
MixinBancorV3(weth)
|
|
||||||
MixinCompound(weth)
|
MixinCompound(weth)
|
||||||
MixinCurve(weth)
|
MixinCurve(weth)
|
||||||
MixinLido(weth)
|
MixinLido(weth)
|
||||||
|
MixinMooniswap(weth)
|
||||||
MixinUniswap(weth)
|
MixinUniswap(weth)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
function _trade(
|
function _trade(
|
||||||
BridgeOrder memory order,
|
BridgeOrder memory order,
|
||||||
IERC20Token sellToken,
|
IERC20Token sellToken,
|
||||||
IERC20Token buyToken,
|
IERC20Token buyToken,
|
||||||
@ -87,121 +87,116 @@ contract EthereumBridgeAdapter is
|
|||||||
bool dryRun
|
bool dryRun
|
||||||
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
||||||
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
||||||
if (protocolId == BridgeProtocols.CURVE) {
|
if (protocolId == BridgeProtocols.UNKNOWN) { //0
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurve(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.CURVEV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV3(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAP) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswap(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.BALANCER) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeBalancer(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.MAKERPSM) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeMakerPsm(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.MSTABLE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeMStable(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.SHELL) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeShell(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.DODO) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeDodo(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.DODOV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeDodoV2(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.CRYPTOCOM) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCryptoCom(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.BANCOR) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeBancor(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.NERVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERDMM) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberDmm(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERELASTIC) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.LIDO) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeLido(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.AAVEV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeAaveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.COMPOUND) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCompound(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.BANCORV3) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeBancorV3(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.SYNTHETIX) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeSynthetix(sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNKNOWN) {
|
|
||||||
if (dryRun) {
|
if (dryRun) {
|
||||||
return (0, true);
|
return (0, true);
|
||||||
}
|
}
|
||||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.CURVE) { //1
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeCurve(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.UNISWAPV2) { //2
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.UNISWAP) { //3
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeUniswap(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.BALANCER) { //4
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeBalancer(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.MOONISWAP) { //6
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeMooniswap(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.MSTABLE) { //7
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeMStable(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.SHELL) { //9
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeShell(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.DODO) { //10
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeDodo(sellToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.DODOV2) { //11
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeDodoV2(sellToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.CRYPTOCOM) { //12
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeCryptoCom(buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.BANCOR) { //13
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeBancor(buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.NERVE) { //15
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.MAKERPSM) { //16
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeMakerPsm(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.UNISWAPV3) { //18
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeUniswapV3(sellToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.KYBERDMM) { //19
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeKyberDmm(buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.CURVEV2) { //20
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeCurveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.LIDO) { //21
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeLido(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.AAVEV2) { //23
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeAaveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.COMPOUND) { //24
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeCompound(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) { //25
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.GMX) { //26
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeGMX(buyToken, sellAmount, order.bridgeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
@ -0,0 +1,93 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
/*
|
||||||
|
Copyright 2023 ZeroEx Intl.
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
pragma solidity ^0.6.5;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
import "./AbstractBridgeAdapter.sol";
|
||||||
|
import "./BridgeProtocols.sol";
|
||||||
|
import "./mixins/MixinPlatypus.sol"; //27
|
||||||
|
import "./mixins/MixinBancorV3.sol"; //28
|
||||||
|
import "./mixins/MixinSolidly.sol"; //29
|
||||||
|
import "./mixins/MixinSynthetix.sol"; //30
|
||||||
|
import "./mixins/MixinWOOFi.sol"; //31
|
||||||
|
import "./mixins/MixinAaveV3.sol"; //32
|
||||||
|
import "./mixins/MixinKyberElastic.sol"; //33
|
||||||
|
|
||||||
|
|
||||||
|
contract BridgeAdapterGroup2 is
|
||||||
|
AbstractBridgeAdapter,
|
||||||
|
MixinPlatypus,
|
||||||
|
MixinBancorV3,
|
||||||
|
MixinSolidly,
|
||||||
|
MixinSynthetix,
|
||||||
|
MixinWOOFi,
|
||||||
|
MixinAaveV3,
|
||||||
|
MixinKyberElastic
|
||||||
|
{
|
||||||
|
constructor(
|
||||||
|
IEtherToken weth
|
||||||
|
)
|
||||||
|
public
|
||||||
|
MixinBancorV3(weth)
|
||||||
|
{}
|
||||||
|
|
||||||
|
function _trade(
|
||||||
|
BridgeOrder memory order,
|
||||||
|
IERC20Token sellToken,
|
||||||
|
IERC20Token buyToken,
|
||||||
|
uint256 sellAmount,
|
||||||
|
bool dryRun
|
||||||
|
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
||||||
|
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
||||||
|
if (protocolId == BridgeProtocols.PLATYPUS) { //27
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradePlatypus(buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.BANCORV3) { //28
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeBancorV3(buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.SOLIDLY) { //29
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeSolidly(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.SYNTHETIX) { //30
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeSynthetix(sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.WOOFI) { //31
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.AAVEV3) { //32
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||||
|
} else if (protocolId == BridgeProtocols.KYBERELASTIC) { //33
|
||||||
|
if (dryRun) {
|
||||||
|
return (0, true);
|
||||||
|
}
|
||||||
|
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
||||||
|
}
|
||||||
|
}
|
@ -38,7 +38,7 @@ library BridgeProtocols {
|
|||||||
uint128 internal constant COFIX = 14; // Not used: deprecated.
|
uint128 internal constant COFIX = 14; // Not used: deprecated.
|
||||||
uint128 internal constant NERVE = 15;
|
uint128 internal constant NERVE = 15;
|
||||||
uint128 internal constant MAKERPSM = 16;
|
uint128 internal constant MAKERPSM = 16;
|
||||||
uint128 internal constant BALANCERV2 = 17;
|
uint128 internal constant BALANCERV2 = 17; // Not used: deprecated.
|
||||||
uint128 internal constant UNISWAPV3 = 18;
|
uint128 internal constant UNISWAPV3 = 18;
|
||||||
uint128 internal constant KYBERDMM = 19;
|
uint128 internal constant KYBERDMM = 19;
|
||||||
uint128 internal constant CURVEV2 = 20;
|
uint128 internal constant CURVEV2 = 20;
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
/*
|
|
||||||
Copyright 2023 ZeroEx Intl.
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pragma solidity ^0.6.5;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
import "./AbstractBridgeAdapter.sol";
|
|
||||||
import "./BridgeProtocols.sol";
|
|
||||||
import "./mixins/MixinNerve.sol";
|
|
||||||
import "./mixins/MixinUniswapV2.sol";
|
|
||||||
import "./mixins/MixinZeroExBridge.sol";
|
|
||||||
|
|
||||||
contract CeloBridgeAdapter is AbstractBridgeAdapter(42220, "Celo"), MixinNerve, MixinUniswapV2, MixinZeroExBridge {
|
|
||||||
constructor(address _weth) public {}
|
|
||||||
|
|
||||||
function _trade(
|
|
||||||
BridgeOrder memory order,
|
|
||||||
IERC20Token sellToken,
|
|
||||||
IERC20Token buyToken,
|
|
||||||
uint256 sellAmount,
|
|
||||||
bool dryRun
|
|
||||||
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
|
||||||
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
|
||||||
if (protocolId == BridgeProtocols.UNISWAPV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.NERVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNKNOWN) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,87 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
/*
|
|
||||||
Copyright 2023 ZeroEx Intl.
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pragma solidity ^0.6.5;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
import "./AbstractBridgeAdapter.sol";
|
|
||||||
import "./BridgeProtocols.sol";
|
|
||||||
import "./mixins/MixinBalancerV2Batch.sol";
|
|
||||||
import "./mixins/MixinCurve.sol";
|
|
||||||
import "./mixins/MixinCurveV2.sol";
|
|
||||||
import "./mixins/MixinNerve.sol";
|
|
||||||
import "./mixins/MixinUniswapV2.sol";
|
|
||||||
import "./mixins/MixinWOOFi.sol";
|
|
||||||
import "./mixins/MixinZeroExBridge.sol";
|
|
||||||
|
|
||||||
contract FantomBridgeAdapter is
|
|
||||||
AbstractBridgeAdapter(250, "Fantom"),
|
|
||||||
MixinBalancerV2Batch,
|
|
||||||
MixinCurve,
|
|
||||||
MixinCurveV2,
|
|
||||||
MixinNerve,
|
|
||||||
MixinUniswapV2,
|
|
||||||
MixinWOOFi,
|
|
||||||
MixinZeroExBridge
|
|
||||||
{
|
|
||||||
constructor(IEtherToken weth) public MixinCurve(weth) {}
|
|
||||||
|
|
||||||
function _trade(
|
|
||||||
BridgeOrder memory order,
|
|
||||||
IERC20Token sellToken,
|
|
||||||
IERC20Token buyToken,
|
|
||||||
uint256 sellAmount,
|
|
||||||
bool dryRun
|
|
||||||
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
|
||||||
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
|
||||||
if (protocolId == BridgeProtocols.CURVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurve(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.CURVEV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.NERVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.WOOFI) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNKNOWN) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,117 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
/*
|
|
||||||
Copyright 2023 ZeroEx Intl.
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pragma solidity ^0.6.5;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
import "./AbstractBridgeAdapter.sol";
|
|
||||||
import "./BridgeProtocols.sol";
|
|
||||||
import "./mixins/MixinAaveV3.sol";
|
|
||||||
import "./mixins/MixinBalancerV2Batch.sol";
|
|
||||||
import "./mixins/MixinCurve.sol";
|
|
||||||
import "./mixins/MixinCurveV2.sol";
|
|
||||||
import "./mixins/MixinKyberElastic.sol";
|
|
||||||
import "./mixins/MixinNerve.sol";
|
|
||||||
import "./mixins/MixinSolidly.sol";
|
|
||||||
import "./mixins/MixinSynthetix.sol";
|
|
||||||
import "./mixins/MixinUniswapV3.sol";
|
|
||||||
import "./mixins/MixinWOOFi.sol";
|
|
||||||
import "./mixins/MixinZeroExBridge.sol";
|
|
||||||
|
|
||||||
contract OptimismBridgeAdapter is
|
|
||||||
AbstractBridgeAdapter(10, "Optimism"),
|
|
||||||
MixinAaveV3,
|
|
||||||
MixinBalancerV2Batch,
|
|
||||||
MixinCurve,
|
|
||||||
MixinCurveV2,
|
|
||||||
MixinKyberElastic,
|
|
||||||
MixinNerve,
|
|
||||||
MixinSynthetix,
|
|
||||||
MixinUniswapV3,
|
|
||||||
MixinSolidly,
|
|
||||||
MixinWOOFi,
|
|
||||||
MixinZeroExBridge
|
|
||||||
{
|
|
||||||
constructor(IEtherToken weth) public MixinCurve(weth) {}
|
|
||||||
|
|
||||||
/* solhint-disable function-max-lines */
|
|
||||||
function _trade(
|
|
||||||
BridgeOrder memory order,
|
|
||||||
IERC20Token sellToken,
|
|
||||||
IERC20Token buyToken,
|
|
||||||
uint256 sellAmount,
|
|
||||||
bool dryRun
|
|
||||||
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
|
||||||
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
|
||||||
if (protocolId == BridgeProtocols.CURVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurve(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.CURVEV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV3(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.NERVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.SOLIDLY) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeSolidly(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.SYNTHETIX) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeSynthetix(sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNKNOWN) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.AAVEV3) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.WOOFI) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERELASTIC) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
|
||||||
}
|
|
||||||
/* solhint-enable function-max-lines */
|
|
||||||
}
|
|
@ -1,150 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
/*
|
|
||||||
Copyright 2023 ZeroEx Intl.
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pragma solidity ^0.6.5;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
import "./AbstractBridgeAdapter.sol";
|
|
||||||
import "./BridgeProtocols.sol";
|
|
||||||
import "./mixins/MixinAaveV3.sol";
|
|
||||||
import "./mixins/MixinAaveV2.sol";
|
|
||||||
import "./mixins/MixinBalancerV2Batch.sol";
|
|
||||||
import "./mixins/MixinCurve.sol";
|
|
||||||
import "./mixins/MixinCurveV2.sol";
|
|
||||||
import "./mixins/MixinDodo.sol";
|
|
||||||
import "./mixins/MixinDodoV2.sol";
|
|
||||||
import "./mixins/MixinKyberDmm.sol";
|
|
||||||
import "./mixins/MixinKyberElastic.sol";
|
|
||||||
import "./mixins/MixinMStable.sol";
|
|
||||||
import "./mixins/MixinNerve.sol";
|
|
||||||
import "./mixins/MixinSolidly.sol";
|
|
||||||
import "./mixins/MixinUniswapV2.sol";
|
|
||||||
import "./mixins/MixinUniswapV3.sol";
|
|
||||||
import "./mixins/MixinWOOFi.sol";
|
|
||||||
import "./mixins/MixinZeroExBridge.sol";
|
|
||||||
|
|
||||||
contract PolygonBridgeAdapter is
|
|
||||||
AbstractBridgeAdapter(137, "Polygon"),
|
|
||||||
MixinAaveV3,
|
|
||||||
MixinAaveV2,
|
|
||||||
MixinBalancerV2Batch,
|
|
||||||
MixinCurve,
|
|
||||||
MixinCurveV2,
|
|
||||||
MixinDodo,
|
|
||||||
MixinDodoV2,
|
|
||||||
MixinKyberDmm,
|
|
||||||
MixinKyberElastic,
|
|
||||||
MixinMStable,
|
|
||||||
MixinNerve,
|
|
||||||
MixinUniswapV2,
|
|
||||||
MixinUniswapV3,
|
|
||||||
MixinSolidly,
|
|
||||||
MixinWOOFi,
|
|
||||||
MixinZeroExBridge
|
|
||||||
{
|
|
||||||
constructor(IEtherToken weth) public MixinCurve(weth) {}
|
|
||||||
|
|
||||||
function _trade(
|
|
||||||
BridgeOrder memory order,
|
|
||||||
IERC20Token sellToken,
|
|
||||||
IERC20Token buyToken,
|
|
||||||
uint256 sellAmount,
|
|
||||||
bool dryRun
|
|
||||||
) internal override returns (uint256 boughtAmount, bool supportedSource) {
|
|
||||||
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
|
||||||
if (protocolId == BridgeProtocols.CURVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurve(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.CURVEV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeCurveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV3(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.MSTABLE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeMStable(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.DODO) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeDodo(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.DODOV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeDodoV2(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.NERVE) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERDMM) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberDmm(buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.KYBERELASTIC) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.AAVEV2) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeAaveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.SOLIDLY) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeSolidly(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.WOOFI) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.UNKNOWN) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
} else if (protocolId == BridgeProtocols.AAVEV3) {
|
|
||||||
if (dryRun) {
|
|
||||||
return (0, true);
|
|
||||||
}
|
|
||||||
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
|
||||||
}
|
|
||||||
}
|
|
@ -36,9 +36,9 @@
|
|||||||
"typechain": "typechain --target=ethers-v5 --out-dir='typechain-wrappers' './foundry-artifacts/**/*.json'"
|
"typechain": "typechain --target=ethers-v5 --out-dir='typechain-wrappers' './foundry-artifacts/**/*.json'"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,PositiveSlippageFeeTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,AffiliateFeeTransformer,MetaTransactionsFeature,LogMetadataTransformer,LiquidityProviderFeature,ILiquidityProviderFeature,NativeOrdersFeature,INativeOrdersFeature,FeeCollectorController,FeeCollector,CurveLiquidityProvider,BatchFillNativeOrdersFeature,IBatchFillNativeOrdersFeature,MultiplexFeature,IMultiplexFeature,OtcOrdersFeature,IOtcOrdersFeature,AvalancheBridgeAdapter,BSCBridgeAdapter,CeloBridgeAdapter,EthereumBridgeAdapter,FantomBridgeAdapter,OptimismBridgeAdapter,PolygonBridgeAdapter",
|
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,PositiveSlippageFeeTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,AffiliateFeeTransformer,MetaTransactionsFeature,LogMetadataTransformer,LiquidityProviderFeature,ILiquidityProviderFeature,NativeOrdersFeature,INativeOrdersFeature,FeeCollectorController,FeeCollector,CurveLiquidityProvider,BatchFillNativeOrdersFeature,IBatchFillNativeOrdersFeature,MultiplexFeature,IMultiplexFeature,OtcOrdersFeature,IOtcOrdersFeature,BridgeAdapter",
|
||||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||||
"abis": "./test/generated-artifacts/@(AbstractBridgeAdapter|AffiliateFeeTransformer|ArbitrumBridgeAdapter|AvalancheBridgeAdapter|BSCBridgeAdapter|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeProtocols|CeloBridgeAdapter|CurveLiquidityProvider|ERC1155OrdersFeature|ERC165Feature|ERC721OrdersFeature|EthereumBridgeAdapter|FantomBridgeAdapter|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinERC1155Spender|FixinERC721Spender|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|FundRecoveryFeature|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC1155OrdersFeature|IERC1155Token|IERC165Feature|IERC20Bridge|IERC20Transformer|IERC721OrdersFeature|IERC721Token|IFeature|IFeeRecipient|IFlashWallet|IFundRecoveryFeature|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|IPropertyValidator|ISimpleFunctionRegistryFeature|IStaking|ITakerCallback|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC1155OrdersStorage|LibERC20Transformer|LibERC721OrdersStorage|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNFTOrder|LibNFTOrdersRichErrors|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinAaveV2|MixinBalancer|MixinBalancerV2Batch|MixinBancor|MixinBancorV3|MixinCompound|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinGMX|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinPlatypus|MixinShell|MixinSolidly|MixinSynthetix|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NFTOrders|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OptimismBridgeAdapter|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PolygonBridgeAdapter|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFeeRecipient|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC1155Token|TestMintableERC20Token|TestMintableERC721Token|TestMooniswap|TestNFTOrderPresigner|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestPropertyValidator|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV2Factory|TestUniswapV2Pool|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json"
|
"abis": "./test/generated-artifacts/@(AbstractBridgeAdapter|AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeAdapterGroup1|BridgeAdapterGroup2|BridgeProtocols|CurveLiquidityProvider|ERC1155OrdersFeature|ERC165Feature|ERC721OrdersFeature|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinERC1155Spender|FixinERC721Spender|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|FundRecoveryFeature|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC1155OrdersFeature|IERC1155Token|IERC165Feature|IERC20Bridge|IERC20Transformer|IERC721OrdersFeature|IERC721Token|IFeature|IFeeRecipient|IFlashWallet|IFundRecoveryFeature|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|IPropertyValidator|ISimpleFunctionRegistryFeature|IStaking|ITakerCallback|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC1155OrdersStorage|LibERC20Transformer|LibERC721OrdersStorage|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNFTOrder|LibNFTOrdersRichErrors|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinAaveV2|MixinBalancer|MixinBalancerV2Batch|MixinBancor|MixinBancorV3|MixinCompound|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinGMX|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinPlatypus|MixinShell|MixinSolidly|MixinSynthetix|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NFTOrders|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFeeRecipient|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC1155Token|TestMintableERC20Token|TestMintableERC721Token|TestMooniswap|TestNFTOrderPresigner|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestPropertyValidator|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV2Factory|TestUniswapV2Pool|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -6,13 +6,9 @@
|
|||||||
import { ContractArtifact } from 'ethereum-types';
|
import { ContractArtifact } from 'ethereum-types';
|
||||||
|
|
||||||
import * as AffiliateFeeTransformer from '../generated-artifacts/AffiliateFeeTransformer.json';
|
import * as AffiliateFeeTransformer from '../generated-artifacts/AffiliateFeeTransformer.json';
|
||||||
import * as AvalancheBridgeAdapter from '../generated-artifacts/AvalancheBridgeAdapter.json';
|
|
||||||
import * as BatchFillNativeOrdersFeature from '../generated-artifacts/BatchFillNativeOrdersFeature.json';
|
import * as BatchFillNativeOrdersFeature from '../generated-artifacts/BatchFillNativeOrdersFeature.json';
|
||||||
import * as BSCBridgeAdapter from '../generated-artifacts/BSCBridgeAdapter.json';
|
import * as BridgeAdapter from '../generated-artifacts/BridgeAdapter.json';
|
||||||
import * as CeloBridgeAdapter from '../generated-artifacts/CeloBridgeAdapter.json';
|
|
||||||
import * as CurveLiquidityProvider from '../generated-artifacts/CurveLiquidityProvider.json';
|
import * as CurveLiquidityProvider from '../generated-artifacts/CurveLiquidityProvider.json';
|
||||||
import * as EthereumBridgeAdapter from '../generated-artifacts/EthereumBridgeAdapter.json';
|
|
||||||
import * as FantomBridgeAdapter from '../generated-artifacts/FantomBridgeAdapter.json';
|
|
||||||
import * as FeeCollector from '../generated-artifacts/FeeCollector.json';
|
import * as FeeCollector from '../generated-artifacts/FeeCollector.json';
|
||||||
import * as FeeCollectorController from '../generated-artifacts/FeeCollectorController.json';
|
import * as FeeCollectorController from '../generated-artifacts/FeeCollectorController.json';
|
||||||
import * as FillQuoteTransformer from '../generated-artifacts/FillQuoteTransformer.json';
|
import * as FillQuoteTransformer from '../generated-artifacts/FillQuoteTransformer.json';
|
||||||
@ -34,11 +30,9 @@ import * as LogMetadataTransformer from '../generated-artifacts/LogMetadataTrans
|
|||||||
import * as MetaTransactionsFeature from '../generated-artifacts/MetaTransactionsFeature.json';
|
import * as MetaTransactionsFeature from '../generated-artifacts/MetaTransactionsFeature.json';
|
||||||
import * as MultiplexFeature from '../generated-artifacts/MultiplexFeature.json';
|
import * as MultiplexFeature from '../generated-artifacts/MultiplexFeature.json';
|
||||||
import * as NativeOrdersFeature from '../generated-artifacts/NativeOrdersFeature.json';
|
import * as NativeOrdersFeature from '../generated-artifacts/NativeOrdersFeature.json';
|
||||||
import * as OptimismBridgeAdapter from '../generated-artifacts/OptimismBridgeAdapter.json';
|
|
||||||
import * as OtcOrdersFeature from '../generated-artifacts/OtcOrdersFeature.json';
|
import * as OtcOrdersFeature from '../generated-artifacts/OtcOrdersFeature.json';
|
||||||
import * as OwnableFeature from '../generated-artifacts/OwnableFeature.json';
|
import * as OwnableFeature from '../generated-artifacts/OwnableFeature.json';
|
||||||
import * as PayTakerTransformer from '../generated-artifacts/PayTakerTransformer.json';
|
import * as PayTakerTransformer from '../generated-artifacts/PayTakerTransformer.json';
|
||||||
import * as PolygonBridgeAdapter from '../generated-artifacts/PolygonBridgeAdapter.json';
|
|
||||||
import * as PositiveSlippageFeeTransformer from '../generated-artifacts/PositiveSlippageFeeTransformer.json';
|
import * as PositiveSlippageFeeTransformer from '../generated-artifacts/PositiveSlippageFeeTransformer.json';
|
||||||
import * as SimpleFunctionRegistryFeature from '../generated-artifacts/SimpleFunctionRegistryFeature.json';
|
import * as SimpleFunctionRegistryFeature from '../generated-artifacts/SimpleFunctionRegistryFeature.json';
|
||||||
import * as TransformERC20Feature from '../generated-artifacts/TransformERC20Feature.json';
|
import * as TransformERC20Feature from '../generated-artifacts/TransformERC20Feature.json';
|
||||||
@ -77,11 +71,5 @@ export const artifacts = {
|
|||||||
IMultiplexFeature: IMultiplexFeature as ContractArtifact,
|
IMultiplexFeature: IMultiplexFeature as ContractArtifact,
|
||||||
OtcOrdersFeature: OtcOrdersFeature as ContractArtifact,
|
OtcOrdersFeature: OtcOrdersFeature as ContractArtifact,
|
||||||
IOtcOrdersFeature: IOtcOrdersFeature as ContractArtifact,
|
IOtcOrdersFeature: IOtcOrdersFeature as ContractArtifact,
|
||||||
AvalancheBridgeAdapter: AvalancheBridgeAdapter as ContractArtifact,
|
BridgeAdapter: BridgeAdapter as ContractArtifact,
|
||||||
BSCBridgeAdapter: BSCBridgeAdapter as ContractArtifact,
|
|
||||||
CeloBridgeAdapter: CeloBridgeAdapter as ContractArtifact,
|
|
||||||
EthereumBridgeAdapter: EthereumBridgeAdapter as ContractArtifact,
|
|
||||||
FantomBridgeAdapter: FantomBridgeAdapter as ContractArtifact,
|
|
||||||
OptimismBridgeAdapter: OptimismBridgeAdapter as ContractArtifact,
|
|
||||||
PolygonBridgeAdapter: PolygonBridgeAdapter as ContractArtifact,
|
|
||||||
};
|
};
|
||||||
|
@ -35,11 +35,7 @@ export * from './bloom_filter_utils';
|
|||||||
export { GREEDY_TOKENS } from './constants';
|
export { GREEDY_TOKENS } from './constants';
|
||||||
export {
|
export {
|
||||||
AffiliateFeeTransformerContract,
|
AffiliateFeeTransformerContract,
|
||||||
AvalancheBridgeAdapterContract,
|
BridgeAdapterContract,
|
||||||
BSCBridgeAdapterContract,
|
|
||||||
CeloBridgeAdapterContract,
|
|
||||||
EthereumBridgeAdapterContract,
|
|
||||||
FantomBridgeAdapterContract,
|
|
||||||
FillQuoteTransformerContract,
|
FillQuoteTransformerContract,
|
||||||
IOwnableFeatureContract,
|
IOwnableFeatureContract,
|
||||||
IOwnableFeatureEvents,
|
IOwnableFeatureEvents,
|
||||||
@ -49,9 +45,7 @@ export {
|
|||||||
IZeroExContract,
|
IZeroExContract,
|
||||||
LogMetadataTransformerContract,
|
LogMetadataTransformerContract,
|
||||||
MultiplexFeatureContract,
|
MultiplexFeatureContract,
|
||||||
OptimismBridgeAdapterContract,
|
|
||||||
PayTakerTransformerContract,
|
PayTakerTransformerContract,
|
||||||
PolygonBridgeAdapterContract,
|
|
||||||
PositiveSlippageFeeTransformerContract,
|
PositiveSlippageFeeTransformerContract,
|
||||||
TransformERC20FeatureContract,
|
TransformERC20FeatureContract,
|
||||||
WethTransformerContract,
|
WethTransformerContract,
|
||||||
|
@ -4,13 +4,9 @@
|
|||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
export * from '../generated-wrappers/affiliate_fee_transformer';
|
export * from '../generated-wrappers/affiliate_fee_transformer';
|
||||||
export * from '../generated-wrappers/avalanche_bridge_adapter';
|
|
||||||
export * from '../generated-wrappers/b_s_c_bridge_adapter';
|
|
||||||
export * from '../generated-wrappers/batch_fill_native_orders_feature';
|
export * from '../generated-wrappers/batch_fill_native_orders_feature';
|
||||||
export * from '../generated-wrappers/celo_bridge_adapter';
|
export * from '../generated-wrappers/bridge_adapter';
|
||||||
export * from '../generated-wrappers/curve_liquidity_provider';
|
export * from '../generated-wrappers/curve_liquidity_provider';
|
||||||
export * from '../generated-wrappers/ethereum_bridge_adapter';
|
|
||||||
export * from '../generated-wrappers/fantom_bridge_adapter';
|
|
||||||
export * from '../generated-wrappers/fee_collector';
|
export * from '../generated-wrappers/fee_collector';
|
||||||
export * from '../generated-wrappers/fee_collector_controller';
|
export * from '../generated-wrappers/fee_collector_controller';
|
||||||
export * from '../generated-wrappers/fill_quote_transformer';
|
export * from '../generated-wrappers/fill_quote_transformer';
|
||||||
@ -32,11 +28,9 @@ export * from '../generated-wrappers/log_metadata_transformer';
|
|||||||
export * from '../generated-wrappers/meta_transactions_feature';
|
export * from '../generated-wrappers/meta_transactions_feature';
|
||||||
export * from '../generated-wrappers/multiplex_feature';
|
export * from '../generated-wrappers/multiplex_feature';
|
||||||
export * from '../generated-wrappers/native_orders_feature';
|
export * from '../generated-wrappers/native_orders_feature';
|
||||||
export * from '../generated-wrappers/optimism_bridge_adapter';
|
|
||||||
export * from '../generated-wrappers/otc_orders_feature';
|
export * from '../generated-wrappers/otc_orders_feature';
|
||||||
export * from '../generated-wrappers/ownable_feature';
|
export * from '../generated-wrappers/ownable_feature';
|
||||||
export * from '../generated-wrappers/pay_taker_transformer';
|
export * from '../generated-wrappers/pay_taker_transformer';
|
||||||
export * from '../generated-wrappers/polygon_bridge_adapter';
|
|
||||||
export * from '../generated-wrappers/positive_slippage_fee_transformer';
|
export * from '../generated-wrappers/positive_slippage_fee_transformer';
|
||||||
export * from '../generated-wrappers/simple_function_registry_feature';
|
export * from '../generated-wrappers/simple_function_registry_feature';
|
||||||
export * from '../generated-wrappers/transform_erc20_feature';
|
export * from '../generated-wrappers/transform_erc20_feature';
|
||||||
|
@ -7,19 +7,16 @@ import { ContractArtifact } from 'ethereum-types';
|
|||||||
|
|
||||||
import * as AbstractBridgeAdapter from '../test/generated-artifacts/AbstractBridgeAdapter.json';
|
import * as AbstractBridgeAdapter from '../test/generated-artifacts/AbstractBridgeAdapter.json';
|
||||||
import * as AffiliateFeeTransformer from '../test/generated-artifacts/AffiliateFeeTransformer.json';
|
import * as AffiliateFeeTransformer from '../test/generated-artifacts/AffiliateFeeTransformer.json';
|
||||||
import * as ArbitrumBridgeAdapter from '../test/generated-artifacts/ArbitrumBridgeAdapter.json';
|
|
||||||
import * as AvalancheBridgeAdapter from '../test/generated-artifacts/AvalancheBridgeAdapter.json';
|
|
||||||
import * as BatchFillNativeOrdersFeature from '../test/generated-artifacts/BatchFillNativeOrdersFeature.json';
|
import * as BatchFillNativeOrdersFeature from '../test/generated-artifacts/BatchFillNativeOrdersFeature.json';
|
||||||
import * as BootstrapFeature from '../test/generated-artifacts/BootstrapFeature.json';
|
import * as BootstrapFeature from '../test/generated-artifacts/BootstrapFeature.json';
|
||||||
|
import * as BridgeAdapter from '../test/generated-artifacts/BridgeAdapter.json';
|
||||||
|
import * as BridgeAdapterGroup1 from '../test/generated-artifacts/BridgeAdapterGroup1.json';
|
||||||
|
import * as BridgeAdapterGroup2 from '../test/generated-artifacts/BridgeAdapterGroup2.json';
|
||||||
import * as BridgeProtocols from '../test/generated-artifacts/BridgeProtocols.json';
|
import * as BridgeProtocols from '../test/generated-artifacts/BridgeProtocols.json';
|
||||||
import * as BSCBridgeAdapter from '../test/generated-artifacts/BSCBridgeAdapter.json';
|
|
||||||
import * as CeloBridgeAdapter from '../test/generated-artifacts/CeloBridgeAdapter.json';
|
|
||||||
import * as CurveLiquidityProvider from '../test/generated-artifacts/CurveLiquidityProvider.json';
|
import * as CurveLiquidityProvider from '../test/generated-artifacts/CurveLiquidityProvider.json';
|
||||||
import * as ERC1155OrdersFeature from '../test/generated-artifacts/ERC1155OrdersFeature.json';
|
import * as ERC1155OrdersFeature from '../test/generated-artifacts/ERC1155OrdersFeature.json';
|
||||||
import * as ERC165Feature from '../test/generated-artifacts/ERC165Feature.json';
|
import * as ERC165Feature from '../test/generated-artifacts/ERC165Feature.json';
|
||||||
import * as ERC721OrdersFeature from '../test/generated-artifacts/ERC721OrdersFeature.json';
|
import * as ERC721OrdersFeature from '../test/generated-artifacts/ERC721OrdersFeature.json';
|
||||||
import * as EthereumBridgeAdapter from '../test/generated-artifacts/EthereumBridgeAdapter.json';
|
|
||||||
import * as FantomBridgeAdapter from '../test/generated-artifacts/FantomBridgeAdapter.json';
|
|
||||||
import * as FeeCollector from '../test/generated-artifacts/FeeCollector.json';
|
import * as FeeCollector from '../test/generated-artifacts/FeeCollector.json';
|
||||||
import * as FeeCollectorController from '../test/generated-artifacts/FeeCollectorController.json';
|
import * as FeeCollectorController from '../test/generated-artifacts/FeeCollectorController.json';
|
||||||
import * as FillQuoteTransformer from '../test/generated-artifacts/FillQuoteTransformer.json';
|
import * as FillQuoteTransformer from '../test/generated-artifacts/FillQuoteTransformer.json';
|
||||||
@ -144,13 +141,11 @@ import * as NativeOrdersInfo from '../test/generated-artifacts/NativeOrdersInfo.
|
|||||||
import * as NativeOrdersProtocolFees from '../test/generated-artifacts/NativeOrdersProtocolFees.json';
|
import * as NativeOrdersProtocolFees from '../test/generated-artifacts/NativeOrdersProtocolFees.json';
|
||||||
import * as NativeOrdersSettlement from '../test/generated-artifacts/NativeOrdersSettlement.json';
|
import * as NativeOrdersSettlement from '../test/generated-artifacts/NativeOrdersSettlement.json';
|
||||||
import * as NFTOrders from '../test/generated-artifacts/NFTOrders.json';
|
import * as NFTOrders from '../test/generated-artifacts/NFTOrders.json';
|
||||||
import * as OptimismBridgeAdapter from '../test/generated-artifacts/OptimismBridgeAdapter.json';
|
|
||||||
import * as OtcOrdersFeature from '../test/generated-artifacts/OtcOrdersFeature.json';
|
import * as OtcOrdersFeature from '../test/generated-artifacts/OtcOrdersFeature.json';
|
||||||
import * as OwnableFeature from '../test/generated-artifacts/OwnableFeature.json';
|
import * as OwnableFeature from '../test/generated-artifacts/OwnableFeature.json';
|
||||||
import * as PancakeSwapFeature from '../test/generated-artifacts/PancakeSwapFeature.json';
|
import * as PancakeSwapFeature from '../test/generated-artifacts/PancakeSwapFeature.json';
|
||||||
import * as PayTakerTransformer from '../test/generated-artifacts/PayTakerTransformer.json';
|
import * as PayTakerTransformer from '../test/generated-artifacts/PayTakerTransformer.json';
|
||||||
import * as PermissionlessTransformerDeployer from '../test/generated-artifacts/PermissionlessTransformerDeployer.json';
|
import * as PermissionlessTransformerDeployer from '../test/generated-artifacts/PermissionlessTransformerDeployer.json';
|
||||||
import * as PolygonBridgeAdapter from '../test/generated-artifacts/PolygonBridgeAdapter.json';
|
|
||||||
import * as PositiveSlippageFeeTransformer from '../test/generated-artifacts/PositiveSlippageFeeTransformer.json';
|
import * as PositiveSlippageFeeTransformer from '../test/generated-artifacts/PositiveSlippageFeeTransformer.json';
|
||||||
import * as SimpleFunctionRegistryFeature from '../test/generated-artifacts/SimpleFunctionRegistryFeature.json';
|
import * as SimpleFunctionRegistryFeature from '../test/generated-artifacts/SimpleFunctionRegistryFeature.json';
|
||||||
import * as TestCurve from '../test/generated-artifacts/TestCurve.json';
|
import * as TestCurve from '../test/generated-artifacts/TestCurve.json';
|
||||||
@ -315,16 +310,11 @@ export const artifacts = {
|
|||||||
Transformer: Transformer as ContractArtifact,
|
Transformer: Transformer as ContractArtifact,
|
||||||
WethTransformer: WethTransformer as ContractArtifact,
|
WethTransformer: WethTransformer as ContractArtifact,
|
||||||
AbstractBridgeAdapter: AbstractBridgeAdapter as ContractArtifact,
|
AbstractBridgeAdapter: AbstractBridgeAdapter as ContractArtifact,
|
||||||
ArbitrumBridgeAdapter: ArbitrumBridgeAdapter as ContractArtifact,
|
BridgeAdapter: BridgeAdapter as ContractArtifact,
|
||||||
AvalancheBridgeAdapter: AvalancheBridgeAdapter as ContractArtifact,
|
BridgeAdapterGroup1: BridgeAdapterGroup1 as ContractArtifact,
|
||||||
BSCBridgeAdapter: BSCBridgeAdapter as ContractArtifact,
|
BridgeAdapterGroup2: BridgeAdapterGroup2 as ContractArtifact,
|
||||||
BridgeProtocols: BridgeProtocols as ContractArtifact,
|
BridgeProtocols: BridgeProtocols as ContractArtifact,
|
||||||
CeloBridgeAdapter: CeloBridgeAdapter as ContractArtifact,
|
|
||||||
EthereumBridgeAdapter: EthereumBridgeAdapter as ContractArtifact,
|
|
||||||
FantomBridgeAdapter: FantomBridgeAdapter as ContractArtifact,
|
|
||||||
IBridgeAdapter: IBridgeAdapter as ContractArtifact,
|
IBridgeAdapter: IBridgeAdapter as ContractArtifact,
|
||||||
OptimismBridgeAdapter: OptimismBridgeAdapter as ContractArtifact,
|
|
||||||
PolygonBridgeAdapter: PolygonBridgeAdapter as ContractArtifact,
|
|
||||||
MixinAaveV2: MixinAaveV2 as ContractArtifact,
|
MixinAaveV2: MixinAaveV2 as ContractArtifact,
|
||||||
MixinBalancer: MixinBalancer as ContractArtifact,
|
MixinBalancer: MixinBalancer as ContractArtifact,
|
||||||
MixinBalancerV2Batch: MixinBalancerV2Batch as ContractArtifact,
|
MixinBalancerV2Batch: MixinBalancerV2Batch as ContractArtifact,
|
||||||
|
@ -28,7 +28,7 @@ import { artifacts } from '../artifacts';
|
|||||||
import { TestFillQuoteTransformerBridgeContract } from '../generated-wrappers/test_fill_quote_transformer_bridge';
|
import { TestFillQuoteTransformerBridgeContract } from '../generated-wrappers/test_fill_quote_transformer_bridge';
|
||||||
import { getRandomLimitOrder, getRandomRfqOrder } from '../utils/orders';
|
import { getRandomLimitOrder, getRandomRfqOrder } from '../utils/orders';
|
||||||
import {
|
import {
|
||||||
EthereumBridgeAdapterContract,
|
BridgeAdapterContract,
|
||||||
FillQuoteTransformerContract,
|
FillQuoteTransformerContract,
|
||||||
TestFillQuoteTransformerExchangeContract,
|
TestFillQuoteTransformerExchangeContract,
|
||||||
TestFillQuoteTransformerHostContract,
|
TestFillQuoteTransformerHostContract,
|
||||||
@ -65,8 +65,8 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
|||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
);
|
);
|
||||||
const bridgeAdapter = await EthereumBridgeAdapterContract.deployFrom0xArtifactAsync(
|
const bridgeAdapter = await BridgeAdapterContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.EthereumBridgeAdapter,
|
artifacts.BridgeAdapter,
|
||||||
env.provider,
|
env.provider,
|
||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
|
@ -5,19 +5,16 @@
|
|||||||
*/
|
*/
|
||||||
export * from '../test/generated-wrappers/abstract_bridge_adapter';
|
export * from '../test/generated-wrappers/abstract_bridge_adapter';
|
||||||
export * from '../test/generated-wrappers/affiliate_fee_transformer';
|
export * from '../test/generated-wrappers/affiliate_fee_transformer';
|
||||||
export * from '../test/generated-wrappers/arbitrum_bridge_adapter';
|
|
||||||
export * from '../test/generated-wrappers/avalanche_bridge_adapter';
|
|
||||||
export * from '../test/generated-wrappers/b_s_c_bridge_adapter';
|
|
||||||
export * from '../test/generated-wrappers/batch_fill_native_orders_feature';
|
export * from '../test/generated-wrappers/batch_fill_native_orders_feature';
|
||||||
export * from '../test/generated-wrappers/bootstrap_feature';
|
export * from '../test/generated-wrappers/bootstrap_feature';
|
||||||
|
export * from '../test/generated-wrappers/bridge_adapter';
|
||||||
|
export * from '../test/generated-wrappers/bridge_adapter_group1';
|
||||||
|
export * from '../test/generated-wrappers/bridge_adapter_group2';
|
||||||
export * from '../test/generated-wrappers/bridge_protocols';
|
export * from '../test/generated-wrappers/bridge_protocols';
|
||||||
export * from '../test/generated-wrappers/celo_bridge_adapter';
|
|
||||||
export * from '../test/generated-wrappers/curve_liquidity_provider';
|
export * from '../test/generated-wrappers/curve_liquidity_provider';
|
||||||
export * from '../test/generated-wrappers/erc1155_orders_feature';
|
export * from '../test/generated-wrappers/erc1155_orders_feature';
|
||||||
export * from '../test/generated-wrappers/erc165_feature';
|
export * from '../test/generated-wrappers/erc165_feature';
|
||||||
export * from '../test/generated-wrappers/erc721_orders_feature';
|
export * from '../test/generated-wrappers/erc721_orders_feature';
|
||||||
export * from '../test/generated-wrappers/ethereum_bridge_adapter';
|
|
||||||
export * from '../test/generated-wrappers/fantom_bridge_adapter';
|
|
||||||
export * from '../test/generated-wrappers/fee_collector';
|
export * from '../test/generated-wrappers/fee_collector';
|
||||||
export * from '../test/generated-wrappers/fee_collector_controller';
|
export * from '../test/generated-wrappers/fee_collector_controller';
|
||||||
export * from '../test/generated-wrappers/fill_quote_transformer';
|
export * from '../test/generated-wrappers/fill_quote_transformer';
|
||||||
@ -142,13 +139,11 @@ export * from '../test/generated-wrappers/native_orders_feature';
|
|||||||
export * from '../test/generated-wrappers/native_orders_info';
|
export * from '../test/generated-wrappers/native_orders_info';
|
||||||
export * from '../test/generated-wrappers/native_orders_protocol_fees';
|
export * from '../test/generated-wrappers/native_orders_protocol_fees';
|
||||||
export * from '../test/generated-wrappers/native_orders_settlement';
|
export * from '../test/generated-wrappers/native_orders_settlement';
|
||||||
export * from '../test/generated-wrappers/optimism_bridge_adapter';
|
|
||||||
export * from '../test/generated-wrappers/otc_orders_feature';
|
export * from '../test/generated-wrappers/otc_orders_feature';
|
||||||
export * from '../test/generated-wrappers/ownable_feature';
|
export * from '../test/generated-wrappers/ownable_feature';
|
||||||
export * from '../test/generated-wrappers/pancake_swap_feature';
|
export * from '../test/generated-wrappers/pancake_swap_feature';
|
||||||
export * from '../test/generated-wrappers/pay_taker_transformer';
|
export * from '../test/generated-wrappers/pay_taker_transformer';
|
||||||
export * from '../test/generated-wrappers/permissionless_transformer_deployer';
|
export * from '../test/generated-wrappers/permissionless_transformer_deployer';
|
||||||
export * from '../test/generated-wrappers/polygon_bridge_adapter';
|
|
||||||
export * from '../test/generated-wrappers/positive_slippage_fee_transformer';
|
export * from '../test/generated-wrappers/positive_slippage_fee_transformer';
|
||||||
export * from '../test/generated-wrappers/simple_function_registry_feature';
|
export * from '../test/generated-wrappers/simple_function_registry_feature';
|
||||||
export * from '../test/generated-wrappers/test_curve';
|
export * from '../test/generated-wrappers/test_curve';
|
||||||
|
@ -25,13 +25,7 @@ import "src/external/TransformerDeployer.sol";
|
|||||||
import "src/transformers/WethTransformer.sol";
|
import "src/transformers/WethTransformer.sol";
|
||||||
import "src/transformers/FillQuoteTransformer.sol";
|
import "src/transformers/FillQuoteTransformer.sol";
|
||||||
import "src/transformers/bridges/BridgeProtocols.sol";
|
import "src/transformers/bridges/BridgeProtocols.sol";
|
||||||
import "src/transformers/bridges/EthereumBridgeAdapter.sol";
|
import "src/transformers/bridges/BridgeAdapter.sol";
|
||||||
import "src/transformers/bridges/PolygonBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/ArbitrumBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/OptimismBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/AvalancheBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/FantomBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/CeloBridgeAdapter.sol";
|
|
||||||
import "src/features/OtcOrdersFeature.sol";
|
import "src/features/OtcOrdersFeature.sol";
|
||||||
|
|
||||||
contract ForkUtilsTest is Test, ForkUtils, TestUtils {
|
contract ForkUtilsTest is Test, ForkUtils, TestUtils {
|
||||||
|
@ -26,7 +26,7 @@ import "src/external/TransformerDeployer.sol";
|
|||||||
import "src/transformers/WethTransformer.sol";
|
import "src/transformers/WethTransformer.sol";
|
||||||
import "src/transformers/FillQuoteTransformer.sol";
|
import "src/transformers/FillQuoteTransformer.sol";
|
||||||
import "src/transformers/bridges/BridgeProtocols.sol";
|
import "src/transformers/bridges/BridgeProtocols.sol";
|
||||||
import "src/transformers/bridges/EthereumBridgeAdapter.sol";
|
import "src/transformers/bridges/BridgeAdapter.sol";
|
||||||
import "src/IZeroEx.sol";
|
import "src/IZeroEx.sol";
|
||||||
|
|
||||||
contract WrapEth is Test, ForkUtils, TestUtils {
|
contract WrapEth is Test, ForkUtils, TestUtils {
|
||||||
|
@ -26,7 +26,7 @@ import "src/external/TransformerDeployer.sol";
|
|||||||
import "src/transformers/WethTransformer.sol";
|
import "src/transformers/WethTransformer.sol";
|
||||||
import "src/transformers/FillQuoteTransformer.sol";
|
import "src/transformers/FillQuoteTransformer.sol";
|
||||||
import "src/transformers/bridges/BridgeProtocols.sol";
|
import "src/transformers/bridges/BridgeProtocols.sol";
|
||||||
import "src/transformers/bridges/EthereumBridgeAdapter.sol";
|
import "src/transformers/bridges/BridgeAdapter.sol";
|
||||||
import "src/IZeroEx.sol";
|
import "src/IZeroEx.sol";
|
||||||
|
|
||||||
contract WrapEthTest is Test, ForkUtils, TestUtils {
|
contract WrapEthTest is Test, ForkUtils, TestUtils {
|
||||||
|
@ -42,7 +42,7 @@ import "src/transformers/PayTakerTransformer.sol";
|
|||||||
import "src/transformers/AffiliateFeeTransformer.sol";
|
import "src/transformers/AffiliateFeeTransformer.sol";
|
||||||
import "src/transformers/PositiveSlippageFeeTransformer.sol";
|
import "src/transformers/PositiveSlippageFeeTransformer.sol";
|
||||||
import "src/transformers/bridges/IBridgeAdapter.sol";
|
import "src/transformers/bridges/IBridgeAdapter.sol";
|
||||||
import "src/transformers/bridges/EthereumBridgeAdapter.sol";
|
import "src/transformers/bridges/BridgeAdapter.sol";
|
||||||
|
|
||||||
import "@0x/contracts-erc20/src/IEtherToken.sol";
|
import "@0x/contracts-erc20/src/IEtherToken.sol";
|
||||||
import "@0x/contracts-erc20/src/v06/WETH9V06.sol";
|
import "@0x/contracts-erc20/src/v06/WETH9V06.sol";
|
||||||
|
@ -23,14 +23,7 @@ import "src/transformers/FillQuoteTransformer.sol";
|
|||||||
import "@0x/contracts-erc20/src/IEtherToken.sol";
|
import "@0x/contracts-erc20/src/IEtherToken.sol";
|
||||||
import "@0x/contracts-erc20/src/IERC20Token.sol";
|
import "@0x/contracts-erc20/src/IERC20Token.sol";
|
||||||
import "src/transformers/bridges/BridgeProtocols.sol";
|
import "src/transformers/bridges/BridgeProtocols.sol";
|
||||||
import "src/transformers/bridges/EthereumBridgeAdapter.sol";
|
import "src/transformers/bridges/BridgeAdapter.sol";
|
||||||
import "src/transformers/bridges/PolygonBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/BSCBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/ArbitrumBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/OptimismBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/AvalancheBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/FantomBridgeAdapter.sol";
|
|
||||||
import "src/transformers/bridges/CeloBridgeAdapter.sol";
|
|
||||||
import "src/IZeroEx.sol";
|
import "src/IZeroEx.sol";
|
||||||
|
|
||||||
//contract-addresses/addresses.json interfaces
|
//contract-addresses/addresses.json interfaces
|
||||||
@ -272,29 +265,7 @@ contract ForkUtils is Test {
|
|||||||
|
|
||||||
//creates the appropriate bridge adapter based on what chain the tests are currently executing on.
|
//creates the appropriate bridge adapter based on what chain the tests are currently executing on.
|
||||||
function createBridgeAdapter(IEtherToken weth) public returns (IBridgeAdapter bridgeAdapter) {
|
function createBridgeAdapter(IEtherToken weth) public returns (IBridgeAdapter bridgeAdapter) {
|
||||||
uint chainId;
|
return IBridgeAdapter(new BridgeAdapter(weth));
|
||||||
|
|
||||||
assembly {
|
|
||||||
chainId := chainid()
|
|
||||||
}
|
|
||||||
if (chainId == 1) {
|
|
||||||
return IBridgeAdapter(new EthereumBridgeAdapter(weth));
|
|
||||||
} else if (chainId == 56) {
|
|
||||||
return IBridgeAdapter(new BSCBridgeAdapter(weth));
|
|
||||||
} else if (chainId == 137) {
|
|
||||||
return IBridgeAdapter(new PolygonBridgeAdapter(weth));
|
|
||||||
} else if (chainId == 43114) {
|
|
||||||
return IBridgeAdapter(new AvalancheBridgeAdapter(weth));
|
|
||||||
} else if (chainId == 250) {
|
|
||||||
return IBridgeAdapter(new FantomBridgeAdapter(weth));
|
|
||||||
} else if (chainId == 10) {
|
|
||||||
return IBridgeAdapter(new OptimismBridgeAdapter(weth));
|
|
||||||
} else if (chainId == 42161) {
|
|
||||||
return IBridgeAdapter(new ArbitrumBridgeAdapter(weth));
|
|
||||||
} else {
|
|
||||||
//ERROR: chainId not mapped
|
|
||||||
revert("ChainId not supported");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//label the addresses that are read from the various .json files
|
//label the addresses that are read from the various .json files
|
||||||
|
@ -4,13 +4,9 @@
|
|||||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*", "./scripts/**/*"],
|
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*", "./scripts/**/*"],
|
||||||
"files": [
|
"files": [
|
||||||
"generated-artifacts/AffiliateFeeTransformer.json",
|
"generated-artifacts/AffiliateFeeTransformer.json",
|
||||||
"generated-artifacts/AvalancheBridgeAdapter.json",
|
|
||||||
"generated-artifacts/BSCBridgeAdapter.json",
|
|
||||||
"generated-artifacts/BatchFillNativeOrdersFeature.json",
|
"generated-artifacts/BatchFillNativeOrdersFeature.json",
|
||||||
"generated-artifacts/CeloBridgeAdapter.json",
|
"generated-artifacts/BridgeAdapter.json",
|
||||||
"generated-artifacts/CurveLiquidityProvider.json",
|
"generated-artifacts/CurveLiquidityProvider.json",
|
||||||
"generated-artifacts/EthereumBridgeAdapter.json",
|
|
||||||
"generated-artifacts/FantomBridgeAdapter.json",
|
|
||||||
"generated-artifacts/FeeCollector.json",
|
"generated-artifacts/FeeCollector.json",
|
||||||
"generated-artifacts/FeeCollectorController.json",
|
"generated-artifacts/FeeCollectorController.json",
|
||||||
"generated-artifacts/FillQuoteTransformer.json",
|
"generated-artifacts/FillQuoteTransformer.json",
|
||||||
@ -32,11 +28,9 @@
|
|||||||
"generated-artifacts/MetaTransactionsFeature.json",
|
"generated-artifacts/MetaTransactionsFeature.json",
|
||||||
"generated-artifacts/MultiplexFeature.json",
|
"generated-artifacts/MultiplexFeature.json",
|
||||||
"generated-artifacts/NativeOrdersFeature.json",
|
"generated-artifacts/NativeOrdersFeature.json",
|
||||||
"generated-artifacts/OptimismBridgeAdapter.json",
|
|
||||||
"generated-artifacts/OtcOrdersFeature.json",
|
"generated-artifacts/OtcOrdersFeature.json",
|
||||||
"generated-artifacts/OwnableFeature.json",
|
"generated-artifacts/OwnableFeature.json",
|
||||||
"generated-artifacts/PayTakerTransformer.json",
|
"generated-artifacts/PayTakerTransformer.json",
|
||||||
"generated-artifacts/PolygonBridgeAdapter.json",
|
|
||||||
"generated-artifacts/PositiveSlippageFeeTransformer.json",
|
"generated-artifacts/PositiveSlippageFeeTransformer.json",
|
||||||
"generated-artifacts/SimpleFunctionRegistryFeature.json",
|
"generated-artifacts/SimpleFunctionRegistryFeature.json",
|
||||||
"generated-artifacts/TransformERC20Feature.json",
|
"generated-artifacts/TransformERC20Feature.json",
|
||||||
@ -44,19 +38,16 @@
|
|||||||
"generated-artifacts/ZeroEx.json",
|
"generated-artifacts/ZeroEx.json",
|
||||||
"test/generated-artifacts/AbstractBridgeAdapter.json",
|
"test/generated-artifacts/AbstractBridgeAdapter.json",
|
||||||
"test/generated-artifacts/AffiliateFeeTransformer.json",
|
"test/generated-artifacts/AffiliateFeeTransformer.json",
|
||||||
"test/generated-artifacts/ArbitrumBridgeAdapter.json",
|
|
||||||
"test/generated-artifacts/AvalancheBridgeAdapter.json",
|
|
||||||
"test/generated-artifacts/BSCBridgeAdapter.json",
|
|
||||||
"test/generated-artifacts/BatchFillNativeOrdersFeature.json",
|
"test/generated-artifacts/BatchFillNativeOrdersFeature.json",
|
||||||
"test/generated-artifacts/BootstrapFeature.json",
|
"test/generated-artifacts/BootstrapFeature.json",
|
||||||
|
"test/generated-artifacts/BridgeAdapter.json",
|
||||||
|
"test/generated-artifacts/BridgeAdapterGroup1.json",
|
||||||
|
"test/generated-artifacts/BridgeAdapterGroup2.json",
|
||||||
"test/generated-artifacts/BridgeProtocols.json",
|
"test/generated-artifacts/BridgeProtocols.json",
|
||||||
"test/generated-artifacts/CeloBridgeAdapter.json",
|
|
||||||
"test/generated-artifacts/CurveLiquidityProvider.json",
|
"test/generated-artifacts/CurveLiquidityProvider.json",
|
||||||
"test/generated-artifacts/ERC1155OrdersFeature.json",
|
"test/generated-artifacts/ERC1155OrdersFeature.json",
|
||||||
"test/generated-artifacts/ERC165Feature.json",
|
"test/generated-artifacts/ERC165Feature.json",
|
||||||
"test/generated-artifacts/ERC721OrdersFeature.json",
|
"test/generated-artifacts/ERC721OrdersFeature.json",
|
||||||
"test/generated-artifacts/EthereumBridgeAdapter.json",
|
|
||||||
"test/generated-artifacts/FantomBridgeAdapter.json",
|
|
||||||
"test/generated-artifacts/FeeCollector.json",
|
"test/generated-artifacts/FeeCollector.json",
|
||||||
"test/generated-artifacts/FeeCollectorController.json",
|
"test/generated-artifacts/FeeCollectorController.json",
|
||||||
"test/generated-artifacts/FillQuoteTransformer.json",
|
"test/generated-artifacts/FillQuoteTransformer.json",
|
||||||
@ -181,13 +172,11 @@
|
|||||||
"test/generated-artifacts/NativeOrdersInfo.json",
|
"test/generated-artifacts/NativeOrdersInfo.json",
|
||||||
"test/generated-artifacts/NativeOrdersProtocolFees.json",
|
"test/generated-artifacts/NativeOrdersProtocolFees.json",
|
||||||
"test/generated-artifacts/NativeOrdersSettlement.json",
|
"test/generated-artifacts/NativeOrdersSettlement.json",
|
||||||
"test/generated-artifacts/OptimismBridgeAdapter.json",
|
|
||||||
"test/generated-artifacts/OtcOrdersFeature.json",
|
"test/generated-artifacts/OtcOrdersFeature.json",
|
||||||
"test/generated-artifacts/OwnableFeature.json",
|
"test/generated-artifacts/OwnableFeature.json",
|
||||||
"test/generated-artifacts/PancakeSwapFeature.json",
|
"test/generated-artifacts/PancakeSwapFeature.json",
|
||||||
"test/generated-artifacts/PayTakerTransformer.json",
|
"test/generated-artifacts/PayTakerTransformer.json",
|
||||||
"test/generated-artifacts/PermissionlessTransformerDeployer.json",
|
"test/generated-artifacts/PermissionlessTransformerDeployer.json",
|
||||||
"test/generated-artifacts/PolygonBridgeAdapter.json",
|
|
||||||
"test/generated-artifacts/PositiveSlippageFeeTransformer.json",
|
"test/generated-artifacts/PositiveSlippageFeeTransformer.json",
|
||||||
"test/generated-artifacts/SimpleFunctionRegistryFeature.json",
|
"test/generated-artifacts/SimpleFunctionRegistryFeature.json",
|
||||||
"test/generated-artifacts/TestCurve.json",
|
"test/generated-artifacts/TestCurve.json",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user