@@ -115,4 +115,35 @@ contract LimitsTest is EulerSwapTestBase {
115
115
vm.expectRevert (EulerSwap.AmountTooBig.selector );
116
116
eulerSwap.swap (0 , type (uint256 ).max, address (this ), "" );
117
117
}
118
+
119
+ function test_quoteWhenAboveCurve () public {
120
+ // Donate 100 and 100 to the pool, raising the reserves above the curve
121
+ assetTST.mint (depositor, 100e18 );
122
+ assetTST2.mint (depositor, 100e18 );
123
+ vm.prank (depositor);
124
+ assetTST.transfer (address (eulerSwap), 10e18 );
125
+ vm.prank (depositor);
126
+ assetTST2.transfer (address (eulerSwap), 10e18 );
127
+ eulerSwap.swap (0 , 0 , address (this ), "" );
128
+
129
+ uint256 amount;
130
+
131
+ // Exact output quotes: Costs nothing to perform this swap (in theory the quote could
132
+ // be negative, but this is not supported by the interface)
133
+
134
+ amount = periphery.quoteExactOutput (address (eulerSwap), address (assetTST), address (assetTST2), 1e18 );
135
+ assertEq (amount, 0 );
136
+
137
+ amount = periphery.quoteExactOutput (address (eulerSwap), address (assetTST2), address (assetTST), 1e18 );
138
+ assertEq (amount, 0 );
139
+
140
+ // Exact input quotes: The additional extractable value is provided as swap output, even
141
+ // with tiny quotes such as 1 wei.
142
+
143
+ amount = periphery.quoteExactInput (address (eulerSwap), address (assetTST), address (assetTST2), 1 );
144
+ assertApproxEqAbs (amount, 19.8e18 , 0.1e18 );
145
+
146
+ amount = periphery.quoteExactInput (address (eulerSwap), address (assetTST2), address (assetTST), 1 );
147
+ assertApproxEqAbs (amount, 19.8e18 , 0.1e18 );
148
+ }
118
149
}
0 commit comments