Fixed Strike Option Teller
Contract that creates and manages the lifecycle of oTokens with a fixed strike price
Overview
Option Teller contracts handle the deployment, creation, and exercise of option tokens. oTokens are ERC20 tokens that represent the right to buy (call) or sell (put) a fixed amount of an asset (payout token) for an amount of another asset (quote token) between two timestamps (eligible and expiry). oTokens are denominated in units of the payout token and are created at a 1:1 ratio for the amount of payout tokens to buy or sell. The amount of quote tokens required to exercise (call) or collateralize (put) an oToken is called the strike price. Strike prices are denominated in units of the quote token.
The Fixed Strike Option Teller implementation creates option tokens that have a fixed strike price that is set at the time of creation.
Deploy and Creating oTokens
In order to create oTokens, an issuer must deploy the specific token configuration on the teller, and then provide collateral to the teller to create option tokens. The collateral is required to guarantee that the oTokens can be exercised. The collateral required depends on the option type.
For call options, the collateral required is an amount of payout tokens equivalent to the amount of option tokens being minted.
For put options, the collateral required is an amount of quote tokens equivalent to the amount of option tokens being minted multiplied by the strike price.
As the name "option" suggests, the holder of an option token has the right, but not the obligation, to exercise the oToken within the eligible time window. If the oToken is not exercised, the designated "receiver" of the oToken exercise proceeds can reclaim the collateral after the expiry timestamp. If an oToken is exercised, the holder receives the collateral and the receiver receives the exercise proceeds.
FixedStrikeOptionTeller
State Variables
protocolFee
Fee paid to protocol when options are exercised in basis points (3 decimal places).
FEE_DECIMALS
Base value used to scale fees. 1e5 = 100%
optionTokenImplementation
FixedStrikeOptionToken reference implementation (deployed on creation to clone from)
minOptionDuration
Minimum duration an option must be eligible to exercise (in seconds)
fees
Fees earned by protocol, by token
optionTokens
Fixed strike option tokens (hash of parameters to address)
collateralClaimed
Whether the receiver of an option token has reclaimed the collateral
User Functions
deploy
Deploy a new ERC20 fixed strike option token and return its address
If an option token already exists for the parameters, it returns that address
Parameters
Name | Type | Description |
---|---|---|
|
| ERC20 token that the purchaser will receive on execution |
|
| ERC20 token used that the purchaser will need to provide on execution |
|
| Timestamp at which the option token can first be executed (gets rounded down to nearest day) |
|
| Timestamp at which the option token can no longer be executed (gets rounded down to nearest day) |
|
| Address that will receive the proceeds when option tokens are exercised. Also the address that can claim collateral from unexercised options. |
|
| Whether the option token is a call (true) or a put (false) |
|
| Strike price of the option token (in units of quoteToken per payoutToken) |
Returns
Name | Type | Description |
---|---|---|
|
| Address of the ERC20 fixed strike option token being created |
create
Deposit an ERC20 token and mint an ERC20 fixed strike option token
Parameters
Name | Type | Description |
---|---|---|
|
| Fixed strike option token to mint |
|
| Amount of option tokens to mint (also the number of payout tokens required to be deposited) |
exercise
Exercise an ERC20 fixed strike option token. Provide required quote tokens and receive amount of payout tokens.
Amount of quote tokens required to exercise is return from the exerciseCost() function
Parameters
Name | Type | Description |
---|---|---|
|
| Fixed strike option token to exercise |
|
| Amount of option tokens to exercise (also the number of payout tokens to receive) |
reclaim
Reclaim collateral from expired option tokens
Parameters
Name | Type | Description |
---|---|---|
|
| Fixed strike option token to reclaim collateral from |
View Functions
exerciseCost
Get the cost to exercise an amount of fixed strike option tokens
Parameters
Name | Type | Description |
---|---|---|
|
| Fixed strike option token to exercise |
|
| Amount of option tokens to exercise |
Returns
Name | Type | Description |
---|---|---|
|
| Token required to exercise (quoteToken for call, payoutToken for put) |
|
| Amount of |
getOptionToken
Get the FixedStrikeOptionToken contract corresponding to the params, reverts if no token exists
Parameters
Name | Type | Description |
---|---|---|
|
| ERC20 token that the purchaser will receive on execution |
|
| ERC20 token used that the purchaser will need to provide on execution |
|
| Timestamp at which the option token can first be executed (gets rounded to nearest day) |
|
| Timestamp at which the option token can no longer be executed (gets rounded to nearest day) |
|
| Address that will receive the proceeds when option tokens are exercised. Also the address that can claim collateral from unexercised options. |
|
| Whether the option token is a call (true) or a put (false) |
|
| Strike price of the option token (in units of quoteToken per payoutToken) |
Returns
Name | Type | Description |
---|---|---|
`optionToken` |
| FixedStrikeOptionToken contract address |
getOptionTokenHash
Get the hash ID of the fixed strike option token with these parameters
Parameters
Name | Type | Description |
---|---|---|
|
| ERC20 token that the purchaser will receive on execution |
|
| ERC20 token used that the purchaser will need to provide on execution |
|
| Timestamp at which the option token can first be executed (gets rounded to nearest day) |
|
| Timestamp at which the option token can no longer be executed (gets rounded to nearest day) |
|
| Address that will receive the proceeds when option tokens are exercised. Also the address that can claim collateral from unexercised options. |
|
| Whether the option token is a call (true) or a put (false) |
|
| Strike price of the option token (in units of quoteToken per payoutToken) |
Returns
Name | Type | Description |
---|---|---|
|
| Hash ID of the fixed strike option token with these parameters |
Admin Functions
setMinOptionDuration
Set minimum duration to exercise option
Absolute minimum is 1 day (86400 seconds) due to timestamp rounding of eligible and expiry parameters
Parameters
Name | Type | Description |
---|---|---|
|
| Minimum duration in seconds |
setProtocolFee
Set protocol fee
Parameters
Name | Type | Description |
---|---|---|
|
| Protocol fee in basis points (3 decimal places) |
claimFees
Claim fees accrued by protocol in the input tokens and sends them to the provided address
Parameters
Name | Type | Description |
---|---|---|
|
| Array of tokens to claim fees for |
|
| Address to send fees to |