How To Create Your Own Pool
You will need 4 steps to create your own option:
    1.
    Get the OptionAMMFactoryaddress
    2.
    Get either the OptionAMMFactory ABI (web3) or the OptionAAMMFactory interface (solidity)
    3.
    Define the parameters of your pool
    4.
    Call the createPool() function with the parameters

1. Get the OptionAMMFactory address

You can find the OptionFactory address using two ways:
1) Check our deployed contracts page here.
2) Instantiate our ConfigurationManager contract and call the function getAMMFactory().

2. Get OptionAMMFactory ABI or Interface

You can find both ABI and interface of OptionFactory in our Github repo. Always check if you are on the master branch to get our latest live update.

3. Define your pool parameters

In order to deploy a new option amm pool you will need only 3 parameters:
    OptionTokenAddress
    StableTokenAddress (We use the assumption that any stable token is equal to 1 USD)
    InitialIV => This is the initial implied volatility for the pool

4. Call the createPool() function

Now that we have the OptionAMMFactory address, ABI, interface and we have also defined the initial parameters, its time call the createPool()function.
Solidity
Web3
1
/// Instantiate Option Factory
2
OptionAMMFactory optionAMMFactory = OptionAMMFactory("/*address*/");
3
4
address optionAddress = 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599;
5
address stableAsset = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48;
6
uint256 initialIV = 1200000000000000000; // Using 18 decimals (120%)
7
8
optionAMMFactory.createPool(
9
optionAddress,
10
stableAsset,
11
initialIV
12
)
13
14
// OptionAMMFactory.sol
15
/**
16
* @param _optionAddress The option address (created with our OptionFactory).
17
* @param _stableAsset The stable token address.
18
* @param _initialIV The
19
*/
20
function createPool(
21
address _optionAddress,
22
address _stableAsset,
23
uint256 _initialIV
24
) public returns (address) {}
Copied!
1
// Parameters example
2
const optionAMMFactoryAddress = '0x3c...'
3
4
const constructorParameters = [
5
"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", // option address
6
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // stable asset address
7
"1200000000000000000" // InitialIV: Using 18 decimals (E.g: 120%)
8
]
9
10
/////////////
11
// Web3.js
12
13
// Instantiate contract
14
const optionAMMFactory = await web3.eth.Contract('Contract ABI', optionAMMFactoryAddress)
15
16
await optionAMMFactory.methods.createPool(...constructorParameters).send({})
17
18
/////////////
19
// Ethers.js
20
21
// Instantiate contract
22
const optionAMMFactory = await ethers.getContractAt(optionAMMFactoryAddress, 'Contract ABI')
23
24
await optionAMMFactory.createPool(...constructorParameters)
Copied!

Last modified 3mo ago