OptionReward

Git Source

Inherits: IOptionReward, ReentrancyGuard

State Variables

BURN_ADDRESS

address internal constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;

Functions

previewOptionParams

Returns the option strike price and maturity timestamp. Note that the on-chain price is constantly updating, therefore, the strike price returned may not be the same as the strike price at the time of underwriting.

function previewOptionParams() public view returns (UD60x18 strike, uint64 maturity);

Returns

NameTypeDescription
strikeUD60x18the option strike price (18 decimals)
maturityuint64the option maturity timestamp

underwrite

Underwrite an option

function underwrite(address longReceiver, UD60x18 contractSize) external nonReentrant;

Parameters

NameTypeDescription
longReceiveraddressthe address that will receive the long tokens
contractSizeUD60x18number of long tokens to mint (18 decimals)

claimRewards

Use expired longs to claim a percentage of expired option intrinsic value as reward, after lockupDuration has passed

function claimRewards(UD60x18 strike, uint64 maturity) external nonReentrant returns (uint256 baseAmount);

Parameters

NameTypeDescription
strikeUD60x18the option strike price (18 decimals)
maturityuint64the option maturity timestamp

Returns

NameTypeDescription
baseAmountuint256the amount of base tokens earned as reward

releaseRewardsNotClaimed

Releases base tokens reserved for claimRewards, if rewards have not be claimed at maturity + lockupDuration + claimDuration

function releaseRewardsNotClaimed(UD60x18 strike, uint64 maturity) external nonReentrant;

Parameters

NameTypeDescription
strikeUD60x18the option strike price (18 decimals)
maturityuint64the option maturity timestamp

getRewardPerContract

Returns the amount of base tokens which can be claimed per long not exercised after the lockup period.

function getRewardPerContract(UD60x18 strike, uint64 maturity) external view returns (UD60x18);

settle

Settle options after the exercise period has ended, reserve base tokens necessary for claimRewards, and transfer excess base tokens + quote tokens to paymentSplitter

function settle(UD60x18 strike, uint64 maturity) external nonReentrant;

Parameters

NameTypeDescription
strikeUD60x18the option strike price (18 decimals)
maturityuint64the option maturity timestamp

getTotalBaseReserved

Returns the amount of base tokens reserved for claimRewards

function getTotalBaseReserved() external view returns (uint256);

getRedeemableLongs

Returns the max amount of expired longs that a user can use to claim rewards for a given option

function getRedeemableLongs(address user, UD60x18 strike, uint64 maturity) external view returns (UD60x18);

getSettings

Returns the option physically settled storage settings

function getSettings()
    external
    view
    returns (
        IOptionPS option,
        IOracleAdapter oracleAdapter,
        IPaymentSplitter paymentSplitter,
        UD60x18 percentOfSpot,
        UD60x18 penalty,
        uint256 optionDuration,
        uint256 lockupDuration,
        uint256 claimDuration,
        UD60x18 fee,
        address feeReceiver
    );

_revertIfPriceIsZero

Revert if price is zero

function _revertIfPriceIsZero(UD60x18 price) internal pure;

_revertIfLockPeriodNotEnded

Revert if lock period has not ended

function _revertIfLockPeriodNotEnded(uint64 maturity) internal view;

_revertIfClaimPeriodEnded

Revert if claim period has not ended

function _revertIfClaimPeriodEnded(uint64 maturity) internal view;

_revertIfClaimPeriodNotEnded

Revert if claim period has not ended

function _revertIfClaimPeriodNotEnded(uint64 maturity) internal view;

_revertIfNotExpired

Revert if the option is not expired

function _revertIfNotExpired(uint64 maturity) internal view;