discuss: Continue if protocol fee insufficient
This commit is contained in:
@@ -412,9 +412,7 @@ contract FillQuoteTransformer is
|
||||
} else {
|
||||
// Ensure we have enough ETH to cover the protocol fee.
|
||||
if (address(this).balance < protocolFee) {
|
||||
LibTransformERC20RichErrors
|
||||
.InsufficientProtocolFeeError(address(this).balance, protocolFee)
|
||||
.rrevert();
|
||||
return results;
|
||||
}
|
||||
// Track changes in the maker token balance.
|
||||
uint256 initialMakerTokenBalance = makerToken.balanceOf(address(this));
|
||||
|
||||
@@ -452,7 +452,7 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
);
|
||||
});
|
||||
|
||||
it('fails if not enough protocol fee provided', async () => {
|
||||
it.skip('fails if not enough protocol fee provided', async () => {
|
||||
const orders = _.times(3, () => createOrder());
|
||||
const signatures = orders.map(() => encodeExchangeBehavior());
|
||||
const qfr = getExpectedSellQuoteFillResults(orders);
|
||||
@@ -970,6 +970,34 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
});
|
||||
});
|
||||
|
||||
it('can continue to the bridge order if the native order reverts', async () => {
|
||||
const nativeOrders = [createOrder()];
|
||||
const bridgeOrders = [createBridgeOrder()];
|
||||
const orders = [...nativeOrders, ...bridgeOrders];
|
||||
const signatures = [
|
||||
...nativeOrders.map(() => encodeExchangeBehavior()), // Valid Signatures
|
||||
...bridgeOrders.map(() => NULL_BYTES), // Valid Signatures
|
||||
];
|
||||
const qfr = getExpectedSellQuoteFillResults(bridgeOrders);
|
||||
await host
|
||||
.executeTransform(
|
||||
transformer.address,
|
||||
takerToken.address,
|
||||
qfr.takerAssetSpent,
|
||||
encodeTransformData({
|
||||
orders,
|
||||
signatures,
|
||||
}),
|
||||
)
|
||||
// Insufficient single protocol fee
|
||||
.awaitTransactionSuccessAsync({ value: singleProtocolFee.minus(1) });
|
||||
assertBalances(await getBalancesAsync(host.address), {
|
||||
...ZERO_BALANCES,
|
||||
makerAssetBalance: qfr.makerAssetBought,
|
||||
protocolFeeBalance: singleProtocolFee,
|
||||
});
|
||||
});
|
||||
|
||||
it('reverts when the bridge transfers less than expected', async () => {
|
||||
const orders = _.times(1, () => createBridgeOrder({}, encodeBridgeBehavior(0.99)));
|
||||
const signatures = orders.map(() => NULL_BYTES);
|
||||
|
||||
Reference in New Issue
Block a user