Skip to main content

ConfigStore

ConfigStore#

ConfigStore stores configuration settings for a perpetual contract and provides an interface for it to query settings such as reward rates, proposal bond sizes, etc. The configuration settings can be upgraded by a privileged account and the upgraded changes are timelocked.

Functions#

constructor(struct ConfigStoreInterface.ConfigSettings _initialConfig, address _timerAddress) (public)

Construct the Config Store. An initial configuration is provided and set on construction.

Parameters:#

  • _initialConfig: Configuration settings to initialize currentConfig with.
  • _timerAddress: Address of testable Timer contract.
updateAndGetCurrentConfig() โ†’ struct ConfigStoreInterface.ConfigSettings (external)

Returns current config or pending config if pending liveness has expired.

proposeNewConfig(struct ConfigStoreInterface.ConfigSettings newConfig) (external)

Propose new configuration settings. New settings go into effect after a liveness period passes.

Callable only by owner. Calling this while there is already a pending proposal will overwrite the pending proposal.

Parameters:#

  • newConfig: Configuration settings to publish after currentConfig.timelockLiveness passes from block.timestamp.
publishPendingConfig() (external)

Publish any pending configuration settings if there is a pending proposal that has passed liveness.

_updateConfig() (internal)
_deletePendingConfig() (internal)
_pendingProposalPassed() โ†’ bool (internal)
_validateConfig(struct ConfigStoreInterface.ConfigSettings config) (internal)
owner() โ†’ address (public)

Returns the address of the current owner.

renounceOwnership() (public)

Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

transferOwnership(address newOwner) (public)

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

_transferOwnership(address newOwner) (internal)

Transfers ownership of the contract to a new account (newOwner). Internal function without access restriction.

_msgSender() โ†’ address (internal)
_msgData() โ†’ bytes (internal)
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
_startReentrantGuardDisabled() (internal)
_endReentrantGuardDisabled() (internal)
setCurrentTime(uint256 time) (external)

Sets the current time.

Will revert if not running in test mode.

Parameters:#

  • time: timestamp to set current Testable time to.
getCurrentTime() โ†’ uint256 (public)

Gets the current time. Will return the last time set in setCurrentTime if running in test mode. Otherwise, it will return the block timestamp.

Events#

ProposedNewConfigSettings(address proposer, uint256 rewardRatePerSecond, uint256 proposerBondPercentage, uint256 timelockLiveness, int256 maxFundingRate, int256 minFundingRate, uint256 proposalTimePastLimit, uint256 proposalPassedTimestamp)
ChangedConfigSettings(uint256 rewardRatePerSecond, uint256 proposerBondPercentage, uint256 timelockLiveness, int256 maxFundingRate, int256 minFundingRate, uint256 proposalTimePastLimit)
OwnershipTransferred(address previousOwner, address newOwner)

Modifiers#

updateConfig()
onlyOwner()

Throws if called by any account other than the owner.

nonReentrant()

Prevents a contract from calling itself, directly or indirectly. Calling a nonReentrant function from another nonReentrant function is not supported. It is possible to prevent this from happening by making the nonReentrant function external, and making it call a private function that does the actual state modification.

nonReentrantView()

Designed to prevent a view-only method from being re-entered during a call to a nonReentrant() state-changing method.

onlyIfTest()

Reverts if not running in test mode.