Skip to content

Commit

Permalink
Refactor require to check for position unit during engage (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachin authored Apr 18, 2022
1 parent a98789a commit 9195ba6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,11 @@ contract DeltaNeutralBasisTradingStrategyExtension is BaseExtension {
function _getAndValidateEngageInfo() internal view returns(LeverageInfo memory) {
ActionInfo memory engageInfo = _createActionInfo();

require(engageInfo.accountInfo.collateralBalance == 0, "PerpV2 collateral balance must be 0");
// Check that there is zero position unit of USDC of collateral value. Allows to neglect dust amounts.
require(
engageInfo.accountInfo.collateralBalance.preciseDiv(engageInfo.setTotalSupply.toInt256()) == 0,
"PerpV2 collateral balance must be 0"
);

return LeverageInfo({
action: engageInfo,
Expand Down

0 comments on commit 9195ba6

Please sign in to comment.