fixed issue where we werent using delegatecall

This commit is contained in:
joshrrose
2023-01-19 11:36:01 -07:00
parent 1fed0c235a
commit 2cd405c1cb
3 changed files with 22 additions and 2 deletions

View File

@@ -307,7 +307,7 @@ contract FillQuoteTransformer is Transformer {
if (success) {
results.makerTokenBoughtAmount = abi.decode(resultData, (uint256));
results.takerTokenSoldAmount = takerTokenFillAmount;
}
}
}
// Fill a single limit order.

View File

@@ -50,7 +50,17 @@ contract EthereumBridgeAdapter is IBridgeAdapter {
) public override returns (uint256 boughtAmount) {
uint128 protocolId = uint128(uint256(order.source) >> 128);
if (protocolId < ADAPTER_1_LENGTH) {
return adapter1.trade(order, sellToken, buyToken, sellAmount);
(bool success, bytes memory resultData) = address(adapter1).delegatecall(abi.encodeWithSelector(
IBridgeAdapter.trade.selector,
order,
sellToken,
buyToken,
sellAmount
)
);
if (success) {
return abi.decode(resultData, (uint256));
}
}
revert("unknown protocolId");
}

View File

@@ -82,6 +82,16 @@ contract EthereumBridgeAdapterGroup1 is
MixinUniswap(weth)
{}
// function trade(
// BridgeOrder memory order,
// IERC20TokenV06 sellToken,
// IERC20TokenV06 buyToken,
// uint256 sellAmount
// ) public override returns (uint256 boughtAmount) {
// (boughtAmount, ) = _trade(order, sellToken, buyToken, sellAmount, false);
// }
function _trade(
BridgeOrder memory order,
IERC20TokenV06 sellToken,