IOptionReward

Git Source

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() external 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;

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 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

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;

Parameters

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

releaseRewardsNotClaimed

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

function releaseRewardsNotClaimed(UD60x18 strike, uint64 maturity) external;

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
    );

Events

Underwrite

event Underwrite(address indexed longReceiver, UD60x18 strike, uint64 maturity, UD60x18 contractSize);

RewardsClaimed

event RewardsClaimed(address indexed user, UD60x18 strike, uint64 maturity, UD60x18 contractSize, UD60x18 baseAmount);

RewardsNotClaimedReleased

event RewardsNotClaimedReleased(UD60x18 strike, uint64 maturity, UD60x18 baseAmount);

Settled

event Settled(
    UD60x18 strike,
    uint64 maturity,
    UD60x18 contractSize,
    UD60x18 intrinsicValuePerContract,
    UD60x18 maxRedeemableLongs,
    UD60x18 baseAmountPaid,
    UD60x18 baseAmountFee,
    UD60x18 quoteAmountPaid,
    UD60x18 quoteAmountFee,
    UD60x18 baseAmountReserved
);

Errors

OptionReward__ClaimPeriodEnded

error OptionReward__ClaimPeriodEnded(uint256 claimEnd);

OptionReward__ClaimPeriodNotEnded

error OptionReward__ClaimPeriodNotEnded(uint256 claimEnd);

OptionReward__InvalidSettlement

error OptionReward__InvalidSettlement();

OptionReward__LockupNotExpired

error OptionReward__LockupNotExpired(uint256 lockupEnd);

OptionReward__NoBaseReserved

error OptionReward__NoBaseReserved(UD60x18 strike, uint256 maturity);

OptionReward__NoRedeemableLongs

error OptionReward__NoRedeemableLongs();

OptionReward__NotCallOption

error OptionReward__NotCallOption(address option);

OptionReward__UnderwriterNotAuthorized

error OptionReward__UnderwriterNotAuthorized(address sender);

OptionReward__OptionNotExpired

error OptionReward__OptionNotExpired(uint256 maturity);

OptionReward__PriceIsZero

error OptionReward__PriceIsZero();

OptionReward__ZeroRewardPerContract

error OptionReward__ZeroRewardPerContract(UD60x18 strike, uint256 maturity);

Structs

SettleVarsInternal

struct SettleVarsInternal {
    UD60x18 intrinsicValuePerContract;
    UD60x18 rewardPerContract;
    UD60x18 totalUnderwritten;
    UD60x18 maxRedeemableLongs;
    UD60x18 baseAmountReserved;
    uint256 fee;
}