LongShortPairCreator
LongShortPairCreator
#
Factory contract to create new instances of long short pair contracts. Responsible for constraining the parameters used to construct a new LSP. These constraints can evolve over time and are initially constrained to conservative values in this first iteration.
#
Functionsconstructor(contract FinderInterface _finder, contract TokenFactory _tokenFactory, address _timer) (public)
Constructs the LongShortPairCreator contract.
#
Parameters:- _finder: UMA protocol Finder used to discover other protocol contracts.
- _tokenFactory: ERC20 token factory used to deploy synthetic token instances.
- _timer: Contract that stores the current time in a testing environment.
createLongShortPair(struct LongShortPairCreator.CreatorParams params) → address (public)
Creates a longShortPair contract and associated long and short tokens. Created LSP is not registered within the registry as the LSP uses the Optimistic Oracle for settlement. The LSP constructor does a number of validations on input params. These are not repeated here.
#
Parameters:- params: Constructor params used to initialize the LSP. Key-valued object with the following structure:
pairName
: Name of the long short pair contract.expirationTimestamp
: Unix timestamp of when the contract will expire.collateralPerPair
: How many units of collateral are required to mint one pair of synthetic tokens.priceIdentifier
: Registered in the DVM for the synthetic.enableEarlyExpiration
: Enables the LSP contract to be settled early.longSynthName
: Name of the long synthetic tokens to be created.longSynthSymbol
: Symbol of the long synthetic tokens to be created.shortSynthName
: Name of the short synthetic tokens to be created.shortSynthSymbol
: Symbol of the short synthetic tokens to be created.collateralToken
: ERC20 token used as collateral in the LSP.financialProductLibrary
: Contract providing settlement payout logic.customAncillaryData
: Custom ancillary data to be passed along with the price request. If not needed, this should be left as a 0-length bytes array.proposerReward
: Optimistic oracle reward amount, pulled from the caller of the expire function.optimisticOracleLivenessTime
: Optimistic oracle liveness time for price requests.optimisticOracleProposerBond
: Optimistic oracle proposer bond for price requests.
_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.
#
EventsCreatedLongShortPair(address longShortPair, address deployerAddress, address longToken, address shortToken)
#
ModifiersnonReentrant()
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.