From 9e937b633ede053eb2d3e669e764c2ec716c33ad Mon Sep 17 00:00:00 2001 From: Peiman Date: Wed, 9 Aug 2023 17:40:54 +0330 Subject: [PATCH] feat: update function name --- protocol/synthetix/contracts/modules/core/VaultModule.sol | 2 +- protocol/synthetix/contracts/storage/Pool.sol | 6 +++--- .../test/integration/modules/core/VaultModule.test.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/protocol/synthetix/contracts/modules/core/VaultModule.sol b/protocol/synthetix/contracts/modules/core/VaultModule.sol index 3e5679486e..82e7a34f1d 100644 --- a/protocol/synthetix/contracts/modules/core/VaultModule.sol +++ b/protocol/synthetix/contracts/modules/core/VaultModule.sol @@ -88,7 +88,7 @@ contract VaultModule is IVaultModule { newCollateralAmountD18 - currentCollateralAmount ); - Pool.loadExisting(poolId).requireSufficientCollateralCapacity( + Pool.loadExisting(poolId).checkPoolCollateralLimit( collateralType, newCollateralAmountD18 - currentCollateralAmount ); diff --git a/protocol/synthetix/contracts/storage/Pool.sol b/protocol/synthetix/contracts/storage/Pool.sol index 13c70b3fd8..e4ca31fe27 100644 --- a/protocol/synthetix/contracts/storage/Pool.sol +++ b/protocol/synthetix/contracts/storage/Pool.sol @@ -53,7 +53,7 @@ library Pool { /** * @dev Thrown when pool has surpassed max collateral deposit */ - error SurpassedPoolMaxCollateralDeposit( + error PoolCollateralLimitExceeded( uint128 poolId, address collateralType, uint256 currentCollateral, @@ -526,7 +526,7 @@ library Pool { } } - function requireSufficientCollateralCapacity( + function checkPoolCollateralLimit( Data storage self, address collateralType, uint256 collateralAmountD18 @@ -537,7 +537,7 @@ library Pool { maxDeposit > 0 && self.vaults[collateralType].currentCollateral() + collateralAmountD18 > maxDeposit ) { - revert SurpassedPoolMaxCollateralDeposit( + revert PoolCollateralLimitExceeded( self.id, collateralType, self.vaults[collateralType].currentCollateral() + collateralAmountD18, diff --git a/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts b/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts index c72aa69914..1bd9b3159f 100644 --- a/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts @@ -407,7 +407,7 @@ describe('VaultModule', function () { depositAmount.mul(2), ethers.utils.parseEther('1') ), - `SurpassedPoolMaxCollateralDeposit("${poolId}", "${collateralAddress()}", "${depositAmount + `PoolCollateralLimitExceeded("${poolId}", "${collateralAddress()}", "${depositAmount .mul(2) .toString()}", "${depositAmount.div(2).toString()}")`, systems().Core