Any options can be deployed from the Primitive Registry contract. There are considerations to make when deploying options.
Each option has six parameters:
underlyingToken: Standard ERC20 Address
strikeToken: Standard ERC20 Address
baseValue: For calls this should be 1e18. For puts, this is the strike price.
quoteValue: For calls this should be the strike price. For calls this should be 1e18.
expiryValue: This is the timestamp for the option to expire at.
/**
* @dev Deploys an option contract clone with create2.
* @param underlyingToken The address of the ERC-20 underlying token.
* @param strikeToken The address of the ERC-20 strike token.
* @param base The quantity of underlying tokens per unit of quote amount of strike tokens.
* @param quote The quantity of strike tokens per unit of base amount of underlying tokens.
* @param expiry The unix timestamp of the option's expiration date.
* @return The address of the deployed option clone.
*/
function deployOption(
address underlyingToken,
address strikeToken,
uint256 base,
uint256 quote,
uint256 expiry
) external override nonReentrant whenNotPaused returns (address) {
// Validation checks for option parameters.
require(base > 0, "ERR_BASE_ZERO");
require(quote > 0, "ERR_QUOTE_ZERO");
require(expiry >= now, "ERR_EXPIRY");
require(underlyingToken != strikeToken, "ERR_SAME_ASSETS");
require(
underlyingToken != address(0x0) && strikeToken != address(0x0),
"ERR_ZERO_ADDRESS"
);
// Deploy option and redeem contract clones.
address optionAddress = IOptionFactory(optionFactory).deployClone(
underlyingToken,
strikeToken,
base,
quote,
expiry
);
address redeemAddress = IRedeemFactory(redeemFactory).deployClone(
optionAddress
);
// Add the clone to the allOptionClones address array.
allOptionClones.push(optionAddress);
// Initialize the new option contract's paired redeem token.
IOptionFactory(optionFactory).initRedeemToken(
optionAddress,
redeemAddress
);
emit DeployedOptionClone(msg.sender, optionAddress, redeemAddress);
return optionAddress;
}
This can be called through etherscan, since theres no available interface for it quite yet.