-
Notifications
You must be signed in to change notification settings - Fork 465
Swallow reverts in ERC20BridgeSampler #2395
Swallow reverts in ERC20BridgeSampler #2395
Conversation
|
6e3e7a8
to
7737a9c
Compare
…ow revets on DEX quotes.
7737a9c
to
b5d7b22
Compare
/// @dev Address of the 0x Exchange contract. | ||
address constant public EXCHANGE_ADDRESS = 0x080bf510FCbF18b91105470639e9561022937712; | ||
/// @dev Address of the 0x DevUtils contract. | ||
address constant public DEVUTILS_ADDRESS = 0xcCc2431a7335F21d9268bA62F0B32B0f2EFC463f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use MixinDeploymentConstants
in the contracts-utils
package for this?
Also nit: this should be DEV_UTILS_ADDRESS
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're OK with adding kyber and all that jazz to it, sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh they already are there 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with it. The unused internal functions won't be part of the bytecode anyways from my understanding.
)); | ||
uint256 rate = 0; | ||
if (didSucceed) { | ||
(rate,) = abi.decode(resultData, (uint256, uint256)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(rate,) = abi.decode(resultData, (uint256))
would be a bit more efficient here.
// convert them to maker asset amounts. | ||
for (uint256 i = 0; i < orders.length; ++i) { | ||
if (orderFillableMakerAssetAmounts[i] != 0) { | ||
orderFillableMakerAssetAmounts[i] = LibMath.getPartialAmountFloor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to use getPartialAmountCeil
here? This will underestimate the actual fillable amount.
…` to `DeploymentConstants`.
8e04b8b
to
3a1ac4f
Compare
3a1ac4f
to
ebccf10
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Description
Quoting external DEXes can revert if the market does not exist (e.g., asking Eth2Dai for ZRX). We could whitelist/blacklist exchanges from pairs in asset-swapper, but it's simpler to just swallow these errors and return zero for the quotes in the sampler contract.
In addition, the sampler will no longer query fillable status for native orders with either:
makerAssetAmount
takerAssetAmount
This is to simplify the case where we don't have any native orders to pass to the sampler, which the sampler needs to extract the token information. Previously we had to clumsily pass in an order with
1
in the asset amounts and aWallet
signature type.Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.