There was an error while loading. Please reload this page.
1 parent 3d960b7 commit 72a31c5Copy full SHA for 72a31c5
1 file changed
src/Trade.sol
@@ -63,7 +63,9 @@ contract Trade is ITrade {
63
uint256 lockedMargin = store.getLockedMargin(user);
64
65
if (int256(lockedMargin + params.margin) > equity) {
66
+ uint256 oldMargin = params.margin;
67
params.margin = uint256(equity - int256(lockedMargin));
68
+ params.size = params.size * params.margin / oldMargin;
69
}
70
71
Store.Market memory market = store.getMarket(params.market);
0 commit comments