Skip to main content

PrePOMarket

Overview

Users can mint/redeem long/short positions on a specific asset in exchange for Collateral tokens.

Position settlement prices are bound by a floor and ceiling set during market initialization.

The value of a Long and Short token should always equal 1 Collateral.

Functions

mintLongShortTokens

  function mintLongShortTokens(
uint256 amount
) external returns (uint256)

Mints Long and Short tokens in exchange for amount Collateral.

Minting is not allowed after the market has ended.

owner() may mint tokens before PublicMinting is enabled to bootstrap a market with an initial supply.

Parameters:

NameTypeDescription
amountuint256Amount of Collateral to deposit

redeem

  function redeem(
uint256 longAmount,
uint256 shortAmount
) external

Redeem longAmount Long and shortAmount Short tokens for Collateral.

Before the market ends, redemptions can only be done with equal parts N Long/Short tokens for N Collateral.

After the market has ended, users can redeem any amount of Long/Short tokens for Collateral.

Parameters:

NameTypeDescription
longAmountuint256Amount of Long tokens to redeem
shortAmountuint256Amount of Short tokens to redeem

setFinalLongPrice

  function setFinalLongPrice(
uint256 newFinalLongPrice
) external

Sets the price a Long token can be redeemed for after the market has ended (in wei units of Collateral).

The contract initializes this to > MAX_PRICE and knows the market has ended when it is set to <= MAX_PRICE.

Only callable by owner().

Parameters:

NameTypeDescription
newFinalLongPriceuint256Price to set Long token redemptions

setTreasury

  function setTreasury(
address newTreasury
) external

Sets the treasury address minting/redemption fees are sent to.

Only callable by owner().

Parameters:

NameTypeDescription
newTreasuryaddressNew treasury address

setMintingFee

  function setMintingFee(
uint256 newMintingFee
) external

Sets the fee for minting Long/Short tokens, must be a 4 decimal place percentage value e.g. 4.9999% = 49999.

Only callable by owner().

Parameters:

NameTypeDescription
newMintingFeeuint256New minting fee

setRedemptionFee

  function setRedemptionFee(
uint256 newRedemptionFee
) external

Sets the fee for redeeming Long/Short tokens, must be a 4 decimal place percentage value e.g. 4.9999% = 49999.

Only callable by owner().

Parameters:

NameTypeDescription
newRedemptionFeeuint256New redemption fee

setPublicMinting

  function setPublicMinting(
bool allowed
) external

Sets whether or not everyone is allowed to mint Long/Short tokens.

Only callable by owner().

Parameters:

NameTypeDescription
allowedboolWhether or not to allow everyone to mint Long/Short

getCollateral

  function getCollateral(
) external returns (contract IERC20)

getTreasury

  function getTreasury(
) external returns (address)

getLongToken

  function getLongToken(
) external returns (contract ILongShortToken)

The PrePOMarket is the owner of this token contract.

getShortToken

  function getShortToken(
) external returns (contract ILongShortToken)

The PrePOMarket is the owner of this token contract.

getFloorLongPrice

  function getFloorLongPrice(
) external returns (uint256)

Returns the lower bound of what a Long token can be priced at (in wei units of Collateral).

Must be less than ceilingLongPrice and MAX_PRICE.

getCeilingLongPrice

  function getCeilingLongPrice(
) external returns (uint256)

Returns the upper bound of what a Long token can be priced at (in wei units of Collateral).

Must be less than MAX_PRICE.

getFinalLongPrice

  function getFinalLongPrice(
) external returns (uint256)

Returns the price a Long token can be redeemed for after the market has ended (in wei units of Collateral).

The contract initializes this to > MAX_PRICE and knows the market has ended when it is set to <= MAX_PRICE.

getMintingFee

  function getMintingFee(
) external returns (uint256)

Returns the fee for minting Long/Short tokens as a 4 decimal place percentage value e.g. 4.9999% = 49999.

getRedemptionFee

  function getRedemptionFee(
) external returns (uint256)

Returns the fee for redeeming Long/Short tokens as a 4 decimal place percentage value e.g. 4.9999% = 49999.

getFloorValuation

  function getFloorValuation(
) external returns (uint256)

Returns valuation of a market when the price of a Long token is at the floor.

getCeilingValuation

  function getCeilingValuation(
) external returns (uint256)

Returns valuation of a market when the price of a Long token is at the ceiling.

getExpiryTime

  function getExpiryTime(
) external returns (uint256)

Returns the timestamp of when the market will expire.

isPublicMintingAllowed

  function isPublicMintingAllowed(
) external returns (bool)

Returns whether Long/Short token minting is open to everyone.

If true, anyone can mint Long/Short tokens, if false, only owner() may mint.

getMaxPrice

  function getMaxPrice(
) external returns (uint256)

Long prices cannot exceed this value, equivalent to 1 ether unit of Collateral.

getFeeDenominator

  function getFeeDenominator(
) external returns (uint256)

Returns the denominator for calculating fees from 4 decimal place percentage values e.g. 4.9999% = 49999.

getFeeLimit

  function getFeeLimit(
) external returns (uint256)

Fee limit of 5% represented as 4 decimal place percentage value e.g. 4.9999% = 49999.

Events

MarketCreated

  event MarketCreated(
address longToken,
address shortToken,
uint256 shortToken,
uint256 floorLongPrice,
uint256 ceilingLongPrice,
uint256 floorValuation,
uint256 ceilingValuation,
uint256 mintingFee,
uint256 redemptionFee,
expiryTime
)

Emitted via constructor()

Parameters:

NameTypeDescription
longTokenaddressMarket Long token address
shortTokenaddressMarket Short token address
shortTokenuint256Market Short token address
floorLongPriceuint256Long token price floor
ceilingLongPriceuint256Long token price ceiling
floorValuationuint256Market valuation floor
ceilingValuationuint256Market valuation ceiling
mintingFeeuint256Market minting fee
redemptionFeeuint256Market redemption fee
expiryTime``Market expiry time

Mint

  event Mint(
address minter,
uint256 amount
)

Emitted via mintLongShortTokens().

Parameters:

NameTypeDescription
minteraddressThe address of the minter
amountuint256The amount of Long/Short tokens minted

Redemption

  event Redemption(
address redeemer,
uint256 amount
)

Emitted via redeem().

Parameters:

NameTypeDescription
redeemeraddressThe address of the redeemer
amountuint256The amount of Long/Short tokens redeemed

FinalLongPriceSet

  event FinalLongPriceSet(
uint256 price
)

Emitted via setFinalLongPrice().

Parameters:

NameTypeDescription
priceuint256The final Long price

TreasuryChanged

  event TreasuryChanged(
address treasury
)

Emitted via setTreasury().

Parameters:

NameTypeDescription
treasuryaddressThe new treasury address

MintingFeeChanged

  event MintingFeeChanged(
uint256 fee
)

Emitted via setMintingFee().

Parameters:

NameTypeDescription
feeuint256The new minting fee

RedemptionFeeChanged

  event RedemptionFeeChanged(
uint256 fee
)

Emitted via setRedemptionFee().

Parameters:

NameTypeDescription
feeuint256The new redemption fee

PublicMintingChanged

  event PublicMintingChanged(
bool allowed
)

Emitted via setPublicMinting().

Parameters:

NameTypeDescription
allowedboolThe new public minting status