From 7078ab9d234419fb1c24fb60062bb58643406d98 Mon Sep 17 00:00:00 2001 From: Haythem Sellami Date: Wed, 2 Jun 2021 20:39:38 +0300 Subject: [PATCH] return 0 proceed if isExcess is false (#418) --- contracts/core/Controller.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/core/Controller.sol b/contracts/core/Controller.sol index 3dc4b33cb..b399d6958 100644 --- a/contracts/core/Controller.sol +++ b/contracts/core/Controller.sol @@ -465,7 +465,10 @@ contract Controller is Initializable, OwnableUpgradeSafe, ReentrancyGuardUpgrade function getProceed(address _owner, uint256 _vaultId) external view returns (uint256) { (MarginVault.Vault memory vault, uint256 typeVault, ) = getVault(_owner, _vaultId); - (uint256 netValue, ) = calculator.getExcessCollateral(vault, typeVault); + (uint256 netValue, bool isExcess) = calculator.getExcessCollateral(vault, typeVault); + + if (!isExcess) return 0; + return netValue; }