SwapOrder.inverted
This commit is contained in:
@@ -39,7 +39,7 @@ contract TestCancelOrder is MockEnv, Test {
|
||||
|
||||
SwapOrder memory order = SwapOrder(
|
||||
0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9, 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1,
|
||||
Route(Exchange.UniswapV3, 500), amount, amount/100, true, false,
|
||||
Route(Exchange.UniswapV3, 500), amount, amount/100, true, false, false,
|
||||
NO_CONDITIONAL_ORDER, tranches
|
||||
);
|
||||
vault.placeDexorder(order);
|
||||
|
||||
@@ -67,17 +67,18 @@ contract TestIEEE754 is Test {
|
||||
Item(float.wrap(0x80200000), 128, int256(uint256(int256(-0x1)))), // smallest negative is subnormal
|
||||
Item(float.wrap(0x7effffff), 128, int256(uint256(0x7fffff8000000000000000000000000000000000000000000000000000000000))), // largest positive
|
||||
Item(float.wrap(0xff7fffff), 128, -int256(uint256(0xffffff0000000000000000000000000000000000000000000000000000000000))), // largest negative
|
||||
Item(float.wrap(0x7f7fffff), 120, int256(uint256(0xffffff0000000000000000000000000000000000000000000000000000000000)))
|
||||
Item(float.wrap(0x7f7fffff), 128, int256(uint256(0xffffff0000000000000000000000000000000000000000000000000000000000)))
|
||||
];
|
||||
|
||||
for (uint i=0; i<items.length; i++) {
|
||||
console2.log("index", i);
|
||||
console2.log("exp: %x", uint256(items[i].fixedPoint));
|
||||
int256 fixedPoint = IEEE754.toFixed(
|
||||
items[i].floatingPoint, items[i].fixedBits
|
||||
);
|
||||
console2.log("got: %x", uint256(fixedPoint));
|
||||
console2.log(IEEE754.isPositive(items[i].floatingPoint)?' positive':' negative');
|
||||
require(items[i].fixedPoint == fixedPoint);
|
||||
require(items[i].fixedPoint == fixedPoint, 'conversion mismatch!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ contract TestOrder is MockEnv, Test {
|
||||
uint256 amount = 100000000000000000000;
|
||||
SwapOrder memory order = SwapOrder(
|
||||
0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9, 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1,
|
||||
Route(Exchange.UniswapV3, 500), amount, amount/100, true, false,
|
||||
Route(Exchange.UniswapV3, 500), amount, amount/100, true, false, false,
|
||||
NO_CONDITIONAL_ORDER, tranches
|
||||
);
|
||||
console2.logBytes(abi.encode(order));
|
||||
@@ -81,7 +81,7 @@ contract TestExecute is TestOrder {
|
||||
SwapOrder memory order = SwapOrder(
|
||||
address(COIN), address(USD), // sell COIN for USD
|
||||
Route(Exchange.UniswapV3, 500), amount, amount/100, false, false,
|
||||
NO_CONDITIONAL_ORDER, tranches
|
||||
false, NO_CONDITIONAL_ORDER, tranches
|
||||
);
|
||||
exactOutputOrderIndex = vault.numSwapOrders();
|
||||
vault.placeDexorder(order);
|
||||
@@ -95,7 +95,7 @@ contract TestExecute is TestOrder {
|
||||
order = SwapOrder(
|
||||
address(COIN), address(USD), // sell COIN for USD
|
||||
Route(Exchange.UniswapV3, fee), amount, amount/100, true, false,
|
||||
NO_CONDITIONAL_ORDER, tranches
|
||||
false, NO_CONDITIONAL_ORDER, tranches
|
||||
);
|
||||
exactInputOrderIndex = vault.numSwapOrders();
|
||||
vault.placeDexorder(order);
|
||||
@@ -126,7 +126,7 @@ contract TestExecute is TestOrder {
|
||||
SwapOrder memory order = SwapOrder(
|
||||
token0, token1, // sell
|
||||
Route(Exchange.UniswapV3, fee), amount, amount/100, true, false,
|
||||
NO_CONDITIONAL_ORDER, tranches
|
||||
false, NO_CONDITIONAL_ORDER, tranches
|
||||
);
|
||||
limitOrderIndex = vault.numSwapOrders();
|
||||
vault.placeDexorder(order);
|
||||
|
||||
Reference in New Issue
Block a user