diff --git a/contracts/erc20-bridge-sampler/CHANGELOG.json b/contracts/erc20-bridge-sampler/CHANGELOG.json index a8382d578e..80a420de7b 100644 --- a/contracts/erc20-bridge-sampler/CHANGELOG.json +++ b/contracts/erc20-bridge-sampler/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "1.6.0", + "changes": [ + { + "note": "Pass in `DevUtils` address as a constructor parameter", + "pr": 2526 + } + ] + }, { "timestamp": 1583220306, "version": "1.5.1", diff --git a/contracts/erc20-bridge-sampler/contracts/src/ERC20BridgeSampler.sol b/contracts/erc20-bridge-sampler/contracts/src/ERC20BridgeSampler.sol index 6bf17a7292..73dc5957c9 100644 --- a/contracts/erc20-bridge-sampler/contracts/src/ERC20BridgeSampler.sol +++ b/contracts/erc20-bridge-sampler/contracts/src/ERC20BridgeSampler.sol @@ -53,6 +53,12 @@ contract ERC20BridgeSampler is /// @dev Default gas limit for liquidity provider calls. uint256 constant internal DEFAULT_CALL_GAS = 200e3; // 200k + address private _devUtilsAddress; + + constructor(address devUtilsAddress) public { + _devUtilsAddress = devUtilsAddress; + } + /// @dev Call multiple public functions on this contract in a single transaction. /// @param callDatas ABI-encoded call data for each function call. /// @return callResults ABI-encoded results data for each call. @@ -97,11 +103,11 @@ contract ERC20BridgeSampler is } // solhint-disable indent (bool didSucceed, bytes memory resultData) = - _getDevUtilsAddress() + _devUtilsAddress .staticcall .gas(DEV_UTILS_CALL_GAS) (abi.encodeWithSelector( - IDevUtils(_getDevUtilsAddress()).getOrderRelevantState.selector, + IDevUtils(_devUtilsAddress).getOrderRelevantState.selector, orders[i], orderSignatures[i] )); diff --git a/contracts/erc20-bridge-sampler/contracts/test/TestERC20BridgeSampler.sol b/contracts/erc20-bridge-sampler/contracts/test/TestERC20BridgeSampler.sol index 06242d91b2..ac4949dc68 100644 --- a/contracts/erc20-bridge-sampler/contracts/test/TestERC20BridgeSampler.sol +++ b/contracts/erc20-bridge-sampler/contracts/test/TestERC20BridgeSampler.sol @@ -307,7 +307,7 @@ contract TestERC20BridgeSampler is uint8 private constant MAX_ORDER_STATUS = uint8(LibOrder.OrderStatus.CANCELLED) + 1; - constructor() public { + constructor() public ERC20BridgeSampler(address(this)) { uniswap = new TestERC20BridgeSamplerUniswapExchangeFactory(); eth2Dai = new TestERC20BridgeSamplerEth2Dai(); kyber = new TestERC20BridgeSamplerKyberNetwork(); @@ -327,6 +327,7 @@ contract TestERC20BridgeSampler is bytes memory ) public + pure returns ( LibOrder.OrderInfo memory orderInfo, uint256 fillableTakerAssetAmount, @@ -357,15 +358,6 @@ contract TestERC20BridgeSampler is return LibDeterministicQuotes.getDeterministicTokenDecimals(tokenAddress); } - // Overriden to point to a this contract. - function _getDevUtilsAddress() - internal - view - returns (address devUtilAddress) - { - return address(this); - } - // Overriden to point to a custom contract. function _getEth2DaiAddress() internal