In order to deploy a new option series, we need to define if the option will be a put, or call, expiration date and exercise size window are some of the option properties.
Below you can find all the parameters that you will need to define:
Input Name
Type
Required
Description
name
string
any
The option token name (e.g., Pod BTC:USDC 300)
symbol
string
any
The option token symbol (e.g., "PodPutBTC")
optionType
uint8
0 / 1
0 for Put, 1 for Call
exerciseType
uint8
0 / 1
0 for American / 1 for European
underlyingAsset
address
contract address
Underlying asset address
strikeAsset
address
contract address
Strike asset address. Works with interest-bearing tokens aToken from Aave.
strikePrice
uint256
any
Strike price (units of strikeAsset that buy 1 unit of underlying) (e.g., 12000000000 means you need 12000000000 units of strike asset to exercise 1 unit of WBTC.)
expiration
uint256
higher than current block timestamp
Expiration option date in UNIX timestamp (e.g., 1609401600)
exerciseWindowSize
uint256
higher than 86400 (24h)
Duration of the exercise windows in seconds.
isAave
bool
If true, deploys a different contract version that supports liquidity mining on Aave (claim rewards)
4. Call the createOption() function
Now that we have the OptionFactory address, ABI, interface and we have also defined the initial parameters, its time call the createOption()function.
/// Instantiate Option FactoryOptionFactory optionFactory =OptionFactory("/*address*/");// Parameters examplestring name ="WBTC:USDC 12000 31Dec 2020";string symbol ="PodPut WBTC:USDC";uint8 optionType =0; // 0 for Put, 1 for Calluint8 exerciseType =0; // 0 for American, 1 for European//WBTCaddress underlyingAsset =0x2260fac5e5542a773aa44fbcfedf7c193bc2c599;// USDCaddress strikeAsset =0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48; uint256 strikePrice =12000000000; // Using 6 decimals, equal to strikeAsset decimalsuint256 expiration =1609401600; // timestamp in seconds: 31 Dec 2020 08AMuint256 exerciseWindowSize =86400; // 24H in secondsuint256 isAave =false; // if the collateral token is not aTokensoptionFactory.createOption( name, symbol, optionType, exerciseType, underlyingAsset, strikeAsset, strikePrice, expiration, exerciseWindowSize, isAave )// OptionFactory.sol/** * @notice creates a new PodPut Contract * @param _name The option token name. Eg. "Pods Put WBTC-USDC 5000 2020-02-23" * @param _symbol The option token symbol. Eg. "podWBTC:20AA" * @param _optionType The option type. Eg. "0 for Put, 1 for Call" * @param _exerciseType The exercise type. Eg. "0 for European, 1 for American" * @param _underlyingAsset The underlying asset. Eg. "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" * @param _strikeAsset The strike asset. Eg. "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" * @param _strikePrice The option strike price including decimals (strikePriceDecimals == strikeAssetDecimals), Eg, 5000000000 * @param _expiration The Expiration Option date in UNIX timestamp. E.g 1600178324 * @param _exerciseWindowSize The Expiration Window Size duration in UNIX timestamp. E.g 24*60*60 (24h) * @param _isAave True if the collateral token is aToken */functioncreateOption( string memory _name, string memory _symbol, PodOption.OptionType _optionType, PodOption.OptionType _exerciseType, address _underlyingAsset, address _strikeAsset, uint256 _strikePrice, uint256 _expiration, uint256 _exerciseWindowSize, bool isAave ) publicreturns (address) {}
// Parameters exampleconstoptionFactoryAddress='0x3c...'constconstructParameters= ["WBTC:USDC 12000 31Dec 2020"; // name"PodPut WBTC:USDC"; // symbol0; // OptionType: 0 for Put, 1 for Call0; // ExerciseType: 0 for American, 1 for European"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; // strikeAsset address"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; // underlyingAsset address"12000000000"; // StrikePrice: Using 6 decimals, equal to strikeAsset decimals1609401600; // timestamp in seconds: 31 Dec 2020 08AM86400; // exercise window sizefalse; // if the collateral is Aave and you want to have liquidity mining support]/////////////// Web3.js// Instantiate contractconstoptionFactory=awaitweb3.eth.Contract('Contract ABI', optionFactoryAddress)awaitoptionFactory.methods.createOption(...constructorParameters).send({})/////////////// Ethers.js// Instantiate contractconstoptionFactory=awaitethers.getContractAt(optionFactoryAddress,'Contract ABI')awaitoptionFactory.createOption(...constructorParameters)