Skip to content

Commit

Permalink
Add Curve and Velodrome to Polygon zkEVM bridge adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
duncancmt committed Nov 1, 2023
1 parent 5ed1a4a commit 633ed60
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@ import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinWOOFi.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinVelodromeV2.sol";

contract PolygonZkevmBridgeAdapter is
AbstractBridgeAdapter(1101, "Polygon zkEVM"),
MixinUniswapV3,
MixinUniswapV2,
MixinBalancerV2Batch,
MixinWOOFi
MixinWOOFi,
MixinCurve,
MixinCurveV2,
MixinVelodromeV2
{
constructor(IEtherToken weth) public MixinCurve(weth) {}

function _trade(
BridgeOrder memory order,
IERC20Token sellToken,
Expand Down Expand Up @@ -57,6 +65,21 @@ contract PolygonZkevmBridgeAdapter is
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.VELODROMEV2) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeVelodromeV2(sellToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
}
Expand Down

0 comments on commit 633ed60

Please sign in to comment.