From f375ec47f63ee156ad6a5299bcb010360f6ae8e3 Mon Sep 17 00:00:00 2001 From: Leonardo Massazza Date: Tue, 4 Jul 2023 11:11:34 -0300 Subject: [PATCH] document GlobalPerpsMarketModule --- .../interfaces/IGlobalPerpsMarketModule.sol | 17 +++++++++++++- .../modules/GlobalPerpsMarketModule.sol | 22 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/markets/perps-market/contracts/interfaces/IGlobalPerpsMarketModule.sol b/markets/perps-market/contracts/interfaces/IGlobalPerpsMarketModule.sol index 386ca5a6ec..fa95e0fa07 100644 --- a/markets/perps-market/contracts/interfaces/IGlobalPerpsMarketModule.sol +++ b/markets/perps-market/contracts/interfaces/IGlobalPerpsMarketModule.sol @@ -36,7 +36,7 @@ interface IGlobalPerpsMarketModule { function setMaxCollateralAmount(uint128 synthMarketId, uint collateralAmount) external; /** - * @notice Obtain the max collateral amount for a specific synth market. + * @notice Gets the max collateral amount for a specific synth market. * @param synthMarketId Synth market id, 0 for snxUSD. * @return maxCollateralAmount max collateral amount of the specified synth market id */ @@ -49,13 +49,28 @@ interface IGlobalPerpsMarketModule { */ function setSynthDeductionPriority(uint128[] memory newSynthDeductionPriority) external; + /** + * @notice Gets the synth deduction priority ordered list. + * @dev The synth deduction priority is used to determine the order in which synths are deducted from an account. Id 0 is snxUSD and should be first in the list. + * @return synthDeductionPriority Ordered array of synth market ids for deduction priority. + */ function getSynthDeductionPriority() external view returns (uint128[] memory); + /** + * @notice Sets the liquidation reward guard (min and max). + * @param minLiquidationRewardUsd Minimum liquidation reward expressed as USD value. + * @param maxLiquidationRewardUsd Maximum liquidation reward expressed as USD value. + */ function setLiquidationRewardGuards( uint256 minLiquidationRewardUsd, uint256 maxLiquidationRewardUsd ) external; + /** + * @notice Gets the liquidation reward guard (min and max). + * @return minLiquidationRewardUsd Minimum liquidation reward expressed as USD value. + * @return maxLiquidationRewardUsd Maximum liquidation reward expressed as USD value. + */ function getLiquidationRewardGuards() external view diff --git a/markets/perps-market/contracts/modules/GlobalPerpsMarketModule.sol b/markets/perps-market/contracts/modules/GlobalPerpsMarketModule.sol index 0f980edc71..8f3ad29ac5 100644 --- a/markets/perps-market/contracts/modules/GlobalPerpsMarketModule.sol +++ b/markets/perps-market/contracts/modules/GlobalPerpsMarketModule.sol @@ -5,9 +5,16 @@ import {GlobalPerpsMarketConfiguration} from "../storage/GlobalPerpsMarketConfig import {IGlobalPerpsMarketModule} from "../interfaces/IGlobalPerpsMarketModule.sol"; import {OwnableStorage} from "@synthetixio/core-contracts/contracts/ownership/OwnableStorage.sol"; +/** + * @title Module for global Perps Market settings. + * @dev See IGlobalPerpsMarketModule. + */ contract GlobalPerpsMarketModule is IGlobalPerpsMarketModule { using GlobalPerpsMarketConfiguration for GlobalPerpsMarketConfiguration.Data; + /** + * @inheritdoc IGlobalPerpsMarketModule + */ function setMaxCollateralAmount( uint128 synthMarketId, uint collateralAmount @@ -19,10 +26,16 @@ contract GlobalPerpsMarketModule is IGlobalPerpsMarketModule { emit MaxCollateralAmountSet(synthMarketId, collateralAmount); } + /** + * @inheritdoc IGlobalPerpsMarketModule + */ function getMaxCollateralAmount(uint128 synthMarketId) external view override returns (uint) { return GlobalPerpsMarketConfiguration.load().maxCollateralAmounts[synthMarketId]; } + /** + * @inheritdoc IGlobalPerpsMarketModule + */ function setSynthDeductionPriority( uint128[] memory newSynthDeductionPriority ) external override { @@ -33,10 +46,16 @@ contract GlobalPerpsMarketModule is IGlobalPerpsMarketModule { emit SynthDeductionPrioritySet(newSynthDeductionPriority); } + /** + * @inheritdoc IGlobalPerpsMarketModule + */ function getSynthDeductionPriority() external view override returns (uint128[] memory) { return GlobalPerpsMarketConfiguration.load().synthDeductionPriority; } + /** + * @inheritdoc IGlobalPerpsMarketModule + */ function setLiquidationRewardGuards( uint256 minLiquidationRewardUsd, uint256 maxLiquidationRewardUsd @@ -49,6 +68,9 @@ contract GlobalPerpsMarketModule is IGlobalPerpsMarketModule { emit LiquidationRewardGuardsSet(minLiquidationRewardUsd, maxLiquidationRewardUsd); } + /** + * @inheritdoc IGlobalPerpsMarketModule + */ function getLiquidationRewardGuards() external view