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.
constructor(contract FinderInterface _finder, contract TokenFactory _tokenFactory, address _timer) (public)
Constructs the LongShortPairCreator contract.
- _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.
The caller must approve this contract to transfer
prepaidProposerReward amount of collateral.
- 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.
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.
prepaidProposerReward: Proposal reward forwarded to the created LSP to incentivize price proposals.
optimisticOracleLivenessTime: Optimistic oracle liveness time for price requests.
optimisticOracleProposerBond: optimistic oracle proposer bond for price requests.
setCurrentTime(uint256 time) (external)
Sets the current time.
Will revert if not running in test mode.
- 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.
CreatedLongShortPair(address longShortPair, address deployerAddress, address longToken, address shortToken)
Prevents a contract from calling itself, directly or indirectly.
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
function that does the actual state modification.
Designed to prevent a view-only method from being re-entered during a call to a
nonReentrant() state-changing method.
Reverts if not running in test mode.