-
Notifications
You must be signed in to change notification settings - Fork 5
Optino Architecture
BokkyPooBah edited this page May 16, 2020
·
4 revisions
WIP
- OptinoFactory deployed
- Option seller executes
OptinoFactory.mint(...)
- Any valid ERC20 token can be used for the pairs. The ERC20 token contract must accurately report
decimals()
- Any price feed in the supported format can be used to calculate the payoff on expiry
- An Optino token contract is deployed for the option series, and Optino tokens are minted to the seller's account
- A Cover token contract is deployed for the option series, and Cover tokens are minted to the seller's account
- The appropriate amount of collateral is transferred from the sellers account to the Cover token contract, and a fee (0.1% of collateral) is transferred to the OptinoFactory owner's account
- Any valid ERC20 token can be used for the pairs. The ERC20 token contract must accurately report
- The option seller can then transfer either the Optino tokens and/or Cover tokens to other accounts, e.g. trading for a premium on a DEX
- Before expiry, a holder of both Optino tokens and Cover tokens can
close(...)
the netted position. The closed tokens are burnt, and the appropriate amount of collateral is transferred to the holder's account - After expiry (Optinos are European options), holders of either Optino or Cover tokens can
settle()
their options. The spot rate is calculated from the price feed and used for the payoff calculation. The settled Optino and/or Cover tokens are burnt. The appropriate amount of collateral is transferred from the Cover token contract to the Optino token holder. And the appropriate amount of collateral is transferred from the Cover token contract to the Cover token holder
The following settle()
test result snippet shows the relationship of the OptinoFactory, Feed, Pair, Series, Optino and Cover token contracts:
optinoFactoryContractAddress=OptinoFactory:0x60c8
optinoFactory.owner/new=deployer:0xa11a/null:0x0000
optinoFactory.optinoTokenTemplate=OptinoToken Template:0xd46b
optinoFactory.message/fee='v0.972-testnet-pre-release'/0.1%
optinoFactory.feedLength=2
optinoFactory.getFeedByIndex(0). ["0xd4bbf07281e6da25b961766635c7ccca82b14351","Maker ETH/USD",["1","18","0"],"190901000000000000000",true,"255","1589597352"]
optinoFactory.getFeedByIndex(1). ["0x1d82a66b23c73f4e45a813962eb01e5dd680aafa","Maker MKR/ETH",["1","18","0"],"1695000000000000000",true,"255","1589597352"]
optinoFactory.pairLength=1
optinoToken.getPairByIndex(0)=["0x78de9d9c9b075497ff0d4156bc893dc8fa38161166aa278d881a8eb23be045c3",["0x93da709247c1f1e6ac6a79f8a1c0f1cce366d8c2","0x8316c07eeb0714e66a7aa83b9c018e56e14d83b7"],["0xd4bbf07281e6da25b961766635c7ccca82b14351","0x0000000000000000000000000000000000000000"],["255","255","255","255","0","0"]]
optinoFactory.getPairByIndex(0). pairKey=0x78de9d9c9b075497ff0d4156bc893dc8fa38161166aa278d881a8eb23be045c3, baseToken='WETH' 'Wrapped Ether (18 dp)':0x93da, quoteToken='USDx' 'USD x (18 dp)':0x8316, feed0=PriceFeed 1:0xd4bb, feed1=null:0x0000, feedParameters=255,255,255,255,0,0
optinoFactory.seriesLength(0)=1
optinoFactory.getSeriesByIndex(0, 0). seriesKey=0x3ae4fe26f0eab6f72caab882701f198a77259d4e4c9c794afbcaca7906f4d471, pairKey=0x78de9d9c9b075497ff0d4156bc893dc8fa38161166aa278d881a8eb23be045c3, callPut=0, expiry=1589597346, strike=150, bound=300, spot=190.901, timestamp=1589597352, optinoToken=0x27eb87ee36d79937427f0f1d1bc0b23b45ab6245, coverToken=0x6a2c33659cd50faf7d84c4da1a869689696dfcec
token: OptinoToken:0x27eb
.owner/new=OptinoFactory:0x60c8/null:0x0000
.details='zOPT0003000005' 'Capped Call Optino 2020-05-16T02:49:06Z 150-300 Maker ETH/USD' 18 dp
.totalSupply=1.25
.seriesKey/seriesNumber=0x3ae4fe26f0eab6f72caab882701f198a77259d4e4c9c794afbcaca7906f4d471/3000005
.isCover/optinoPair=false/CoverToken:0x6a2c
.collateralToken/decimals: 'WETH' 'Wrapped Ether (18 dp)':0x93da/18
.pairData: ["0x78de9d9c9b075497ff0d4156bc893dc8fa38161166aa278d881a8eb23be045c3",["0x93da709247c1f1e6ac6a79f8a1c0f1cce366d8c2","0x8316c07eeb0714e66a7aa83b9c018e56e14d83b7"],["0xd4bbf07281e6da25b961766635c7ccca82b14351","0x0000000000000000000000000000000000000000"],["255","255","255","255","0","0"]]
.seriesData: ["0x3ae4fe26f0eab6f72caab882701f198a77259d4e4c9c794afbcaca7906f4d471","0x78de9d9c9b075497ff0d4156bc893dc8fa38161166aa278d881a8eb23be045c3",["0","1589597346","150000000000000000000","300000000000000000000","190901000000000000000"],"0x27eb87ee36d79937427f0f1d1bc0b23b45ab6245","0x6a2c33659cd50faf7d84c4da1a869689696dfcec"]
.closedOrSettled=8.75
.currentSpot/currentPayoff(1)=190.901/0.214252413554669697
.spot/payoff(1)=190.901/0.214252413554669697
token: CoverToken:0x6a2c
.owner/new=OptinoFactory:0x60c8/null:0x0000
.details='zCOV0003000005' 'Capped Call Cover 2020-05-16T02:49:06Z 150-300 Maker ETH/USD' 18 dp
.totalSupply=1.25
.seriesKey/seriesNumber=0x3ae4fe26f0eab6f72caab882701f198a77259d4e4c9c794afbcaca7906f4d471/3000005
.isCover/optinoPair=true/OptinoToken:0x27eb
.collateralToken/decimals: 'WETH' 'Wrapped Ether (18 dp)':0x93da/18
.pairData: ["0x78de9d9c9b075497ff0d4156bc893dc8fa38161166aa278d881a8eb23be045c3",["0x93da709247c1f1e6ac6a79f8a1c0f1cce366d8c2","0x8316c07eeb0714e66a7aa83b9c018e56e14d83b7"],["0xd4bbf07281e6da25b961766635c7ccca82b14351","0x0000000000000000000000000000000000000000"],["255","255","255","255","0","0"]]
.seriesData: ["0x3ae4fe26f0eab6f72caab882701f198a77259d4e4c9c794afbcaca7906f4d471","0x78de9d9c9b075497ff0d4156bc893dc8fa38161166aa278d881a8eb23be045c3",["0","1589597346","150000000000000000000","300000000000000000000","190901000000000000000"],"0x27eb87ee36d79937427f0f1d1bc0b23b45ab6245","0x6a2c33659cd50faf7d84c4da1a869689696dfcec"]
.closedOrSettled=8.75
.currentSpot/currentPayoff(1)=190.901/0.285747586445330303
.spot/payoff(1)=190.901/0.285747586445330303
.Payoff 0 #748 optinoOrCoverToken=OptinoToken:0x27eb tokenOwner=seller1:0xa22a tokens=1.25 collateralPaid=0.267815516943337122
.Payoff 1 #748 optinoOrCoverToken=CoverToken:0x6a2c tokenOwner=seller1:0xa22a tokens=1.25 collateralPaid=0.357184483056662878
SeriesSpotUpdated 0 #748 {"seriesKey":"0x3ae4fe26f0eab6f72caab882701f198a77259d4e4c9c794afbcaca7906f4d471","spot":"190901000000000000000"}