Control Facet (0.8.4)
Control Facet (0.8.4)
The Control Facet is an administrative interface within the SYMM system. It allows authorized users to perform essential management tasks such as transferring ownership, setting and revoking roles, registering or deregistering Party Bs and affiliates, and configuring various operational parameters. Centralizing these functions ensures that administrative actions are executed securely and efficiently.
Ownership & Role Management
transferOwnership()
Description: Transfers Diamond contract ownership to a new address. Only the current owner can call this function.
Function Signature:
Parameters:
owner
: The address of the new owner (must not be the zero address).
Example:
Events Emitted:
OwnershipTransferred(previousOwner, _newOwner)
setAdmin()
Description: Grants the admin role to a specified user. This function is restricted to the current owner.
Function Signature:
Parameters:
user
: The address of the user to be granted admin privileges.
Example:
Events Emitted:
RoleGranted(DEFAULT_ADMIN_ROLE, user)
grantRole()
Grants a specific role to a user. For example, this can be used to assign roles like LIQUIDATOR_ROLE
or MUON_SETTER_ROLE
.
Note: For LIQUIDATOR_ROLE
, additional checks ensure that a Party A without pending quotes or open positions is assigned.
Function Signature:
Parameters:
user
: The address of the user.role
: The role identifier (e.g., LIQUIDATOR_ROLE).
Example:
Events Emitted:
RoleGranted(role, user)
revokeRole()
Revokes a specific role from a user.
Function Signature:
Parameters:
user
: The address of the user.role
: The role identifier to revoke.
Example:
Events Emitted:
RoleRevoked(role, user)
Registration & Affiliate Management
registerPartyB()
Registers a Party B address in the system. Only callable by an account with the PARTY_B_MANAGER_ROLE
.
Function Signature:
Parameters:
partyB
: The address to register (must not be the zero address).
Example:
Events Emitted:
RegisterPartyB(partyB)
deregisterPartyB()
Deregisters a Party B address. Requires the index of the Party B in the stored list.
Function Signature:
Parameters:
partyB
: The address to deregister.index
: The index of the Party B in the partyB list.
Example:
Events Emitted:
DeregisterPartyB(partyB, index)
registerAffiliate()
Registers an affiliate into the system. Only callable by an account with the AFFILIATE_MANAGER_ROLE
.
Function Signature:
Parameters:
affiliate
: The affiliate address to register.
Example:
Events Emitted:
RegisterAffiliate(affiliate)
deregisterAffiliate()
Deregisters an affiliate from the system.
Function Signature:
Parameters:
affiliate
: The affiliate address to deregister.
Example:
Events Emitted:
DeregisterAffiliate(affiliate)
Muon & Collateral Configuration
setMuonConfig()
Sets configuration parameters for the Muon network—specifically, the validity durations for upnl and price data.
Function Signature:
Parameters:
upnlValidTime
: Duration (in seconds) for which upnl data is considered valid.priceValidTime
: Duration (in seconds) for which price data is valid.
Example:
Events Emitted:
SetMuonConfig(upnlValidTime, priceValidTime)
setMuonIds()
Configures the Muon application ID, gateway address, and public key.
Function Signature:
Parameters:
muonAppId
: The Muon application ID.validGateway
: The valid gateway address.publicKey
: The Muon public key (structure containing key data).
Example:
Events Emitted:
SetMuonIds(muonAppId, validGateway, publicKey.x, publicKey.parity)
setCollateral()
Sets the address of the collateral token used by the system. This function ensures that the token has 18 or fewer decimals and that no collateral remains in the contract when switching tokens.
Function Signature:
Parameters:
collateral
: The address of the new collateral token.
Example:
Events Emitted:
SetCollateral(collateral)
Fee Collector & Debounce Settings
setFeeCollector()
Sets the fee collector address for a specific affiliate. This function is restricted to the AFFILIATE_MANAGER_ROLE
.
Function Signature:
Parameters:
affiliate
: The affiliate whose fee collector is being set.feeCollector
: The new fee collector address.
Example:
Events Emitted:
SetFeeCollector(affiliate, oldFeeCollector, feeCollector)
setDefaultFeeCollector()
Sets the default fee collector address, which acts as a fallback for affiliates that have not been assigned a custom fee collector.
Function Signature:
Parameters:
feeCollector
: The new default fee collector address.
Example:
Events Emitted:
SetDefaultFeeCollector(oldDefaultFeeCollector, feeCollector)
setDeallocateDebounceTime()
Sets the debounce time for deallocation requests. This prevents users from deallocating funds too frequently by enforcing a minimum time window between requests.
Function Signature:
Parameters:
deallocateDebounceTime
: The new debounce time (in seconds).
Example:
Events Emitted:
SetDeallocateDebounceTime(oldDeallocateDebounceTime, deallocateDebounceTime)
setInvalidBridgedAmountsPool()
Sets the address of the pool that will receive any invalid bridged amounts.
Function Signature:
Parameters:
pool
: The new pool address (must not be the zero address).
Example:
Events Emitted:
SetInvalidBridgedAmountsPool(oldInvalidBridgedAmountsPool, pool)
Symbol Management
addSymbol() & addSymbols()
Adds a new trading symbol to the system or adds multiple symbols in one call. Each symbol includes parameters such as minimum acceptable quote value, trading fee, and leverage limits.
Function Signature (addSymbol):
Parameters:
name
: The name of the symbol.minAcceptableQuoteValue
: Minimum quote value.minAcceptablePortionLF
: Minimum liquidation fee portion.tradingFee
: Trading fee for the symbol.maxLeverage
: Maximum leverage allowed.fundingRateEpochDuration
: Duration of each funding epoch.fundingRateWindowTime
: Time window for funding rate calculations (must be less than half the epoch duration).
Events Emitted:
AddSymbol(symbolId, name, minAcceptableQuoteValue, minAcceptablePortionLF, tradingFee, maxLeverage, fundingRateEpochDuration, fundingRateWindowTime)
For multiple symbols, use addSymbols with an array of Symbol structs.
setSymbolFundingState()
Updates the funding rate parameters for a specific symbol.
Function Signature:
Parameters:
symbolId
: The ID of the symbol.fundingRateEpochDuration
: New epoch duration.fundingRateWindowTime
: New window time.
Events Emitted:
SetSymbolFundingState(symbolId, fundingRateEpochDuration, fundingRateWindowTime)
setSymbolValidationState()
Changes the validation state (active/inactive) of a symbol.
Function Signature:
Parameters:
symbolId
: The ID of the symbol.isValid
: The new validation state.
Example:
Events Emitted:
SetSymbolValidationState(symbolId, oldState, isValid)
setSymbolMaxLeverage()
Updates the maximum leverage for a given symbol.
Function Signature:
Parameters:
symbolId
: The symbol's ID.maxLeverage
: The new maximum leverage.
Example:
Events Emitted:
SetSymbolMaxLeverage(symbolId, oldMaxLeverage, maxLeverage)
setSymbolAcceptableValues()
Sets the minimum acceptable quote value and liquidation fee portion for a symbol.
Function Signature:
Parameters:
symbolId
: The symbol's ID.minAcceptableQuoteValue
: New minimum quote value.minAcceptablePortionLF
: New minimum liquidation fee portion.
Example:
Events Emitted:
SetSymbolAcceptableValues(symbolId, oldMinAcceptableQuoteValue, oldMinAcceptablePortionLF, minAcceptableQuoteValue, minAcceptablePortionLF)
setSymbolTradingFee()
Updates the trading fee for a specific symbol.
Function Signature:
Parameters:
symbolId
: The symbol's ID.tradingFee
: The new trading fee.
Example:
Events Emitted:
SetSymbolTradingFee(symbolId, oldTradingFee, tradingFee)
setForceCloseGapRatio()
Sets the force close gap ratio for a specific symbol. Different symbols may require different gap ratios based on volatility.
Function Signature:
Parameters:
symbolId
: The ID of the symbol.forceCloseGapRatio
: The new gap ratio.
Example:
Events Emitted:
SetForceCloseGapRatio(symbolId, oldForceCloseGapRatio, forceCloseGapRatio)
Cooldown & Penalty Settings
setDeallocateCooldown()
Sets the cooldown period required after deallocation before withdrawals can proceed.
Function Signature:
Parameters:
deallocateCooldown
: New cooldown period (in seconds).
Example:
Events Emitted:
SetDeallocateCooldown(oldDeallocateCooldown, deallocateCooldown)
setForceCancelCooldown()
Description: Configures the cooldown period for force cancellation requests.
Function Signature:
Parameters:
forceCancelCooldown
: New cooldown period (in seconds).
Example:
Events Emitted:
SetForceCancelCooldown(oldForceCancelCooldown, forceCancelCooldown)
setForceCloseCooldowns()
Description: Sets two cooldown periods for force closing positions: one for before the target price is reached and one for after.
Function Signature:
Parameters:
forceCloseFirstCooldown
: The first cooldown period (in seconds).forceCloseSecondCooldown
: The second cooldown period (in seconds).
Example:
Events Emitted:
SetForceCloseCooldowns(oldForceCloseFirstCooldown, forceCloseFirstCooldown, oldForceCloseSecondCooldown, forceCloseSecondCooldown)
setForceClosePricePenalty()
Sets the penalty applied to Party B during force closing based on price deviations.
Function Signature:
Parameters:
forceClosePricePenalty
: The new penalty value.
Example:
Events Emitted:
SetForceClosePricePenalty(oldPricePenalty, forceClosePricePenalty)
setForceCloseMinSigPeriod()
Sets the minimum signature period required for force closing positions.
Function Signature:
Parameters:
forceCloseMinSigPeriod
: The new minimum signature period (in seconds).
Example:
Events Emitted:
SetForceCloseMinSigPeriod(oldCloseMinSigPeriod, forceCloseMinSigPeriod)
setForceCancelCloseCooldown()
Sets the cooldown period for force canceling of close requests.
Function Signature:
Parameters:
forceCancelCloseCooldown
: New cooldown period (in seconds).
Example:
Events Emitted:
SetForceCancelCloseCooldown(oldForceCancelCloseCooldown, forceCancelCloseCooldown)
setSettlementCooldown()
Sets the cooldown period for settling upnl (unrealized profit and loss) for positions.
Function Signature:
Parameters:
settlementCooldown
: New cooldown period (in seconds).
Example:
Events Emitted:
SetSettlementCooldown(oldSettlementCooldown, settlementCooldown)
setLiquidatorShare()
Sets the percentage of funds distributed to liquidators from liquidated positions.
Function Signature:
Parameters:
liquidatorShare
: New share percentage.
Example:
Events Emitted:
SetLiquidatorShare(oldLiquidatorShare, liquidatorShare)
Pause & Emergency Operations
Pausing Functions
Multiple functions exist to pause various system operations. For example:
pauseGlobal() pauses all global operations.
pauseLiquidation() pauses liquidation activities.
pauseAccounting() pauses accounting operations.
pausePartyAActions() and pausePartyBActions() pause Party A or Party B specific actions.
pauseInternalTransfer() pauses internal transfers.
Example:
Events Emitted:
Corresponding events such as PauseGlobal()
, PausePartyAActions()
, etc.
Emergency Mode
Activates emergency mode for the protocol. This is used to when hedgers must close positions without requiring any action on the partyA's part.
Function Signature:
Example:
Events Emitted:
ActiveEmergencyMode()
Unpausing Functions
Description: Functions to resume operations once paused:
unpauseGlobal()
unpauseLiquidation()
unpauseAccounting()
unpausePartyAActions()
unpausePartyBActions()
unpauseInternalTransfer()
Example:
Events Emitted:
Events such as UnpauseGlobal()
, UnpauseInternalTransfer()
, etc.
Deactivating Emergency Mode
Deactivates emergency mode.
Function Signature:
Example:
Events Emitted:
DeactiveEmergencyMode()
Liquidation & Suspension Controls
setLiquidationTimeout()
Sets the timeout duration for liquidation of partyBs between their initial liquidation and when all their positions are liquidated.
Function Signature:
Parameters:
liquidationTimeout
: New timeout duration (in seconds).
Example:
Events Emitted:
SetLiquidationTimeout(oldLiquidationTimeout, liquidationTimeout)
suspendedAddress() & unsuspendedAddress()
Suspends or unsuspends a user’s address.
Function Signatures:
Parameters:
user
: The address to (un)suspend.
Example:
Events Emitted:
SetSuspendedAddress(user, true)
andSetSuspendedAddress(user, false)
setPartyBEmergencyStatus()
Sets the emergency status for multiple Party B addresses.
Function Signature:
Parameters:
partyBs
: Array of Party B addresses.status
: Emergency status to set (true or false).
Example:
Events Emitted:
SetPartyBEmergencyStatus(partyB, status)
for each address.
Bridge Management
addBridge()
Adds a new bridge address to the system.
Function Signature:
Parameters:
bridge
: The address of the bridge to add.
Example:
Events Emitted:
AddBridge(bridge)
removeBridge()
Removes a bridge address from the system.
Function Signature:
Parameters:
bridge
: The address of the bridge to remove.
Example:
Events Emitted:
RemoveBridge(bridge)
Last updated