Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
@0x/contracts-erc20-bridge-sampler: Pass in DevUtils address as a…
Browse files Browse the repository at this point in the history
… constructor parameter
  • Loading branch information
dorothy-zbornak committed Mar 26, 2020
1 parent 277dbac commit d40cdcd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
9 changes: 9 additions & 0 deletions contracts/erc20-bridge-sampler/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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]
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -327,6 +327,7 @@ contract TestERC20BridgeSampler is
bytes memory
)
public
pure
returns (
LibOrder.OrderInfo memory orderInfo,
uint256 fillableTakerAssetAmount,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d40cdcd

Please sign in to comment.