From 8cbbb9052546831aa8447b75d9cda6b379a3cfe8 Mon Sep 17 00:00:00 2001 From: Anton Cheng Date: Fri, 7 Aug 2020 18:33:07 +0800 Subject: [PATCH] Add coverage badge (#140) * Add coverage badge * Remove unused contracts * Update Docs * Update MockUniswapFactory --- README.md | 2 +- contracts/OptionsUtils.sol | 40 -------------- contracts/lib/MockUniswapFactory.sol | 23 +++++--- docs/CTokenInterface.md | 3 +- docs/CompoundOracleInterface.md | 3 +- docs/Context.md | 1 - docs/Dai.md | 1 - docs/ERC20.md | 1 - docs/ERC20Detailed.md | 1 - docs/ERC20Mintable.md | 1 - docs/IERC20.md | 1 - docs/IOptionsExchange.md | 56 ------------------- docs/LibNote.md | 1 - docs/Migrations.md | 1 - docs/MinterRole.md | 1 - docs/MockCompoundOracle.md | 1 - docs/MockUniswapFactory.md | 9 ++- docs/OptionsContract.md | 3 +- docs/OptionsExchange.md | 3 +- docs/OptionsFactory.md | 1 - docs/OptionsUtils.md | 5 +- docs/Oracle.md | 12 ++-- docs/Ownable.md | 1 - docs/Roles.md | 1 - docs/SafeMath.md | 1 - docs/StringComparator.md | 1 - docs/TestImports.md | 1 - docs/UniswapExchangeInterface.md | 3 +- docs/UniswapFactoryInterface.md | 3 +- docs/oToken.md | 1 - migrations/2_deploy_contracts.js | 83 ++++++++++++++++++---------- 31 files changed, 86 insertions(+), 179 deletions(-) delete mode 100644 contracts/OptionsUtils.sol delete mode 100644 docs/IOptionsExchange.md diff --git a/README.md b/README.md index 78f1206..43fcee8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Convexity Protocol [![CircleCI](https://circleci.com/gh/opynfinance/OptionsProtocol/tree/dev.svg?style=svg&circle-token=dff9c1ce21f639bc170ef267bf2a93f43a5e5870)](https://circleci.com/gh/opynfinance/OptionsProtocol/tree/dev) +# Convexity Protocol [![CircleCI](https://circleci.com/gh/opynfinance/OptionsProtocol/tree/dev.svg?style=svg&circle-token=dff9c1ce21f639bc170ef267bf2a93f43a5e5870)](https://circleci.com/gh/opynfinance/OptionsProtocol/tree/dev)[![Coverage Status](https://coveralls.io/repos/github/opynfinance/OptionsProtocol/badge.svg?branch=dev)](https://coveralls.io/github/opynfinance/OptionsProtocol?branch=dev) This vault contains all the smart contracts for Opyn's Convexity Protocol. Convexity allows options sellers to earn premiums on their collateral and options buyers to protect themselves against technical, financial and systemic risks that the underlying token faces. diff --git a/contracts/OptionsUtils.sol b/contracts/OptionsUtils.sol deleted file mode 100644 index bcd677a..0000000 --- a/contracts/OptionsUtils.sol +++ /dev/null @@ -1,40 +0,0 @@ -pragma solidity 0.5.10; - -import "./interfaces/CompoundOracleInterface.sol"; -import "./interfaces/UniswapExchangeInterface.sol"; -import "./interfaces/UniswapFactoryInterface.sol"; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; - - -contract OptionsUtils { - // defauls are for mainnet - UniswapFactoryInterface public uniswapFactory; - - CompoundOracleInterface public compoundOracle; - - constructor(address _uniswapFactory, address _compoundOracle) public { - uniswapFactory = UniswapFactoryInterface(_uniswapFactory); - compoundOracle = CompoundOracleInterface(_compoundOracle); - } - - // TODO: for now gets Uniswap, later update to get other exchanges - function getExchange(address _token) - public - view - returns (UniswapExchangeInterface) - { - if (address(uniswapFactory.getExchange(_token)) == address(0)) { - revert("No payout exchange"); - } - - UniswapExchangeInterface exchange = UniswapExchangeInterface( - uniswapFactory.getExchange(_token) - ); - - return exchange; - } - - function isETH(IERC20 _ierc20) public pure returns (bool) { - return _ierc20 == IERC20(0); - } -} diff --git a/contracts/lib/MockUniswapFactory.sol b/contracts/lib/MockUniswapFactory.sol index 0b0ed4f..004b39c 100644 --- a/contracts/lib/MockUniswapFactory.sol +++ b/contracts/lib/MockUniswapFactory.sol @@ -7,19 +7,28 @@ contract MockUniswapFactory { address public exchangeTemplate; uint256 public tokenCount; + mapping(uint256 => address) public idToToken; + mapping(address => address) public exchanges; + mapping(address => address) public tokens; + address public _exchange; + // Create Exchange function createExchange(address token) external pure returns (address exchange) { - return 0x06D014475F84Bb45b9cdeD1Cf3A1b8FE3FbAf128; + return token; // return random address. } // Get Exchange and Token Info - function getExchange(address token) external pure returns (address exchange){ - return 0x06D014475F84Bb45b9cdeD1Cf3A1b8FE3FbAf128; + function getExchange(address token) external view returns (address exchange){ + return exchanges[token]; + } + function getToken(address exchange) external view returns (address token) { + return tokens[exchange]; } - function getToken(address exchange) external pure returns (address token) { - return 0x06D014475F84Bb45b9cdeD1Cf3A1b8FE3FbAf128; + function getTokenWithId(uint256 tokenId) external view returns (address token) { + return idToToken[tokenId]; } - function getTokenWithId(uint256 tokenId) external pure returns (address token) { - return 0x06D014475F84Bb45b9cdeD1Cf3A1b8FE3FbAf128; + function setTokenExchange(address token, address exchange) public { + exchanges[token] = exchange; + tokens[exchange] = token; } // Never use function initializeFactory(address template) external { diff --git a/docs/CTokenInterface.md b/docs/CTokenInterface.md index 036b6cc..1c02045 100644 --- a/docs/CTokenInterface.md +++ b/docs/CTokenInterface.md @@ -1,6 +1,6 @@ # CTokenInterface.sol -View Source: [contracts/lib/CTokenInterface.sol](../contracts/lib/CTokenInterface.sol) +View Source: [contracts/interfaces/CTokenInterface.sol](../contracts/interfaces/CTokenInterface.sol) **CTokenInterface** @@ -264,7 +264,6 @@ returns(uint256) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/CompoundOracleInterface.md b/docs/CompoundOracleInterface.md index 43edc30..0385f2e 100644 --- a/docs/CompoundOracleInterface.md +++ b/docs/CompoundOracleInterface.md @@ -1,6 +1,6 @@ # CompoundOracleInterface.sol -View Source: [contracts/lib/CompoundOracleInterface.sol](../contracts/lib/CompoundOracleInterface.sol) +View Source: [contracts/interfaces/CompoundOracleInterface.sol](../contracts/interfaces/CompoundOracleInterface.sol) **CompoundOracleInterface** @@ -63,7 +63,6 @@ returns(uint256) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/Context.md b/docs/Context.md index e68b57f..5f5e6d9 100644 --- a/docs/Context.md +++ b/docs/Context.md @@ -57,7 +57,6 @@ returns(bytes) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/Dai.md b/docs/Dai.md index 638023a..edc229f 100644 --- a/docs/Dai.md +++ b/docs/Dai.md @@ -278,7 +278,6 @@ function permit(address holder, address spender, uint256 nonce, uint256 expiry, * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/ERC20.md b/docs/ERC20.md index ef4ecb2..7647c2c 100644 --- a/docs/ERC20.md +++ b/docs/ERC20.md @@ -324,7 +324,6 @@ function _burnFrom(address account, uint256 amount) internal nonpayable * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/ERC20Detailed.md b/docs/ERC20Detailed.md index c3d97f6..6bd48b3 100644 --- a/docs/ERC20Detailed.md +++ b/docs/ERC20Detailed.md @@ -103,7 +103,6 @@ returns(uint8) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/ERC20Mintable.md b/docs/ERC20Mintable.md index c26e2b1..71b7b96 100644 --- a/docs/ERC20Mintable.md +++ b/docs/ERC20Mintable.md @@ -42,7 +42,6 @@ returns(bool) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/IERC20.md b/docs/IERC20.md index 1487a82..cd30d9e 100644 --- a/docs/IERC20.md +++ b/docs/IERC20.md @@ -158,7 +158,6 @@ returns(bool) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/IOptionsExchange.md b/docs/IOptionsExchange.md deleted file mode 100644 index 024b0c3..0000000 --- a/docs/IOptionsExchange.md +++ /dev/null @@ -1,56 +0,0 @@ -# Options Exchange interface (IOptionsExchange.sol) - -View Source: [contracts/interfaces/IOptionsExchange.sol](../contracts/interfaces/IOptionsExchange.sol) - -**IOptionsExchange** - -## Functions - -- [sellOTokens(address payable receiver, address oTokenAddress, address payoutTokenAddress, uint256 oTokensToSell)](#sellotokens) - -### sellOTokens - -This function sells oTokens on Uniswap and sends back payoutTokens to the receiver - -```js -function sellOTokens(address payable receiver, address oTokenAddress, address payoutTokenAddress, uint256 oTokensToSell) external nonpayable -``` - -**Arguments** - -| Name | Type | Description | -| ------------- |------------- | -----| -| receiver | address payable | The address to send the payout tokens back to | -| oTokenAddress | address | The address of the oToken to sell | -| payoutTokenAddress | address | The address of the token to receive the premiums in | -| oTokensToSell | uint256 | The number of oTokens to sell | - -## Contracts - -* [CompoundOracleInterface](CompoundOracleInterface.md) -* [Context](Context.md) -* [CTokenInterface](CTokenInterface.md) -* [Dai](Dai.md) -* [ERC20](ERC20.md) -* [ERC20Detailed](ERC20Detailed.md) -* [ERC20Mintable](ERC20Mintable.md) -* [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) -* [LibNote](LibNote.md) -* [Migrations](Migrations.md) -* [MinterRole](MinterRole.md) -* [MockCompoundOracle](MockCompoundOracle.md) -* [MockUniswapFactory](MockUniswapFactory.md) -* [OptionsContract](OptionsContract.md) -* [OptionsExchange](OptionsExchange.md) -* [OptionsFactory](OptionsFactory.md) -* [OptionsUtils](OptionsUtils.md) -* [Oracle](Oracle.md) -* [oToken](oToken.md) -* [Ownable](Ownable.md) -* [Roles](Roles.md) -* [SafeMath](SafeMath.md) -* [StringComparator](StringComparator.md) -* [TestImports](TestImports.md) -* [UniswapExchangeInterface](UniswapExchangeInterface.md) -* [UniswapFactoryInterface](UniswapFactoryInterface.md) diff --git a/docs/LibNote.md b/docs/LibNote.md index 20242b8..1a37f3f 100644 --- a/docs/LibNote.md +++ b/docs/LibNote.md @@ -279,7 +279,6 @@ function permit(address holder, address spender, uint256 nonce, uint256 expiry, * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/Migrations.md b/docs/Migrations.md index 42bf8ff..4475850 100644 --- a/docs/Migrations.md +++ b/docs/Migrations.md @@ -79,7 +79,6 @@ function upgrade(address new_address) public nonpayable restricted * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/MinterRole.md b/docs/MinterRole.md index 4e0a035..fbfbd5c 100644 --- a/docs/MinterRole.md +++ b/docs/MinterRole.md @@ -127,7 +127,6 @@ function _removeMinter(address account) internal nonpayable * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/MockCompoundOracle.md b/docs/MockCompoundOracle.md index 2a35abf..b5a2ef9 100644 --- a/docs/MockCompoundOracle.md +++ b/docs/MockCompoundOracle.md @@ -64,7 +64,6 @@ function updatePrice(uint256 newPrice) public nonpayable * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/MockUniswapFactory.md b/docs/MockUniswapFactory.md index d282835..be7836e 100644 --- a/docs/MockUniswapFactory.md +++ b/docs/MockUniswapFactory.md @@ -36,7 +36,7 @@ function () public nonpayable ### createExchange ```js -function createExchange(address token) external nonpayable +function createExchange(address token) external pure returns(exchange address) ``` @@ -49,7 +49,7 @@ returns(exchange address) ### getExchange ```js -function getExchange(address token) external view +function getExchange(address token) external pure returns(exchange address) ``` @@ -62,7 +62,7 @@ returns(exchange address) ### getToken ```js -function getToken(address exchange) external view +function getToken(address exchange) external pure returns(token address) ``` @@ -75,7 +75,7 @@ returns(token address) ### getTokenWithId ```js -function getTokenWithId(uint256 tokenId) external view +function getTokenWithId(uint256 tokenId) external pure returns(token address) ``` @@ -107,7 +107,6 @@ function initializeFactory(address template) external nonpayable * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/OptionsContract.md b/docs/OptionsContract.md index 1766440..a1f1045 100644 --- a/docs/OptionsContract.md +++ b/docs/OptionsContract.md @@ -47,7 +47,7 @@ int32 public underlyingExp; contract IERC20 public collateral; contract IERC20 public underlying; contract IERC20 public strike; -contract CompoundOracleInterface public COMPOUND_ORACLE; +contract CompoundOracleInterface public compoundOracle; string public name; string public symbol; uint8 public decimals; @@ -718,7 +718,6 @@ returns(uint256) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/OptionsExchange.md b/docs/OptionsExchange.md index b678341..379a536 100644 --- a/docs/OptionsExchange.md +++ b/docs/OptionsExchange.md @@ -13,7 +13,7 @@ uint256 internal constant LARGE_BLOCK_SIZE; uint256 internal constant LARGE_APPROVAL_NUMBER; //public members -contract UniswapFactoryInterface public UNISWAP_FACTORY; +contract UniswapFactoryInterface public uniswapFactory; ``` @@ -198,7 +198,6 @@ function () external payable * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/OptionsFactory.md b/docs/OptionsFactory.md index 9d120af..0a50318 100644 --- a/docs/OptionsFactory.md +++ b/docs/OptionsFactory.md @@ -156,7 +156,6 @@ returns(bool) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/OptionsUtils.md b/docs/OptionsUtils.md index 501fe52..81b1372 100644 --- a/docs/OptionsUtils.md +++ b/docs/OptionsUtils.md @@ -8,8 +8,8 @@ View Source: [contracts/OptionsUtils.sol](../contracts/OptionsUtils.sol) **Constants & Variables** ```js -contract UniswapFactoryInterface public UNISWAP_FACTORY; -contract CompoundOracleInterface public COMPOUND_ORACLE; +contract UniswapFactoryInterface public uniswapFactory; +contract CompoundOracleInterface public compoundOracle; ``` @@ -68,7 +68,6 @@ returns(bool) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/Oracle.md b/docs/Oracle.md index 1c2377f..b53126e 100644 --- a/docs/Oracle.md +++ b/docs/Oracle.md @@ -8,13 +8,10 @@ View Source: [contracts/Oracle.sol](../contracts/Oracle.sol) **Constants & Variables** ```js -//internal members -mapping(address => bool) internal isCToken; -mapping(address => address) internal assetToCTokens; -address internal cETH; - -//public members -contract CompoundOracleInterface public PriceOracle; +mapping(address => bool) public isCToken; +mapping(address => address) public assetToCTokens; +address public cETH; +contract CompoundOracleInterface public priceOracle; ``` @@ -86,7 +83,6 @@ returns(uint256) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/Ownable.md b/docs/Ownable.md index 56edd7e..055873a 100644 --- a/docs/Ownable.md +++ b/docs/Ownable.md @@ -150,7 +150,6 @@ function _transferOwnership(address newOwner) internal nonpayable * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/Roles.md b/docs/Roles.md index 3850e45..52b821a 100644 --- a/docs/Roles.md +++ b/docs/Roles.md @@ -81,7 +81,6 @@ bool * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/SafeMath.md b/docs/SafeMath.md index 33c3c55..075203e 100644 --- a/docs/SafeMath.md +++ b/docs/SafeMath.md @@ -209,7 +209,6 @@ returns(uint256) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/StringComparator.md b/docs/StringComparator.md index f8a0daf..6cdf7d9 100644 --- a/docs/StringComparator.md +++ b/docs/StringComparator.md @@ -32,7 +32,6 @@ returns(bool) * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/TestImports.md b/docs/TestImports.md index 654203f..9c0a581 100644 --- a/docs/TestImports.md +++ b/docs/TestImports.md @@ -29,7 +29,6 @@ function () public nonpayable * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/UniswapExchangeInterface.md b/docs/UniswapExchangeInterface.md index 1eb0340..e367804 100644 --- a/docs/UniswapExchangeInterface.md +++ b/docs/UniswapExchangeInterface.md @@ -1,6 +1,6 @@ # UniswapExchangeInterface.sol -View Source: [contracts/lib/UniswapExchangeInterface.sol](../contracts/lib/UniswapExchangeInterface.sol) +View Source: [contracts/interfaces/UniswapExchangeInterface.sol](../contracts/interfaces/UniswapExchangeInterface.sol) **UniswapExchangeInterface** @@ -519,7 +519,6 @@ function setup(address token_addr) external nonpayable * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/UniswapFactoryInterface.md b/docs/UniswapFactoryInterface.md index e812c69..087e327 100644 --- a/docs/UniswapFactoryInterface.md +++ b/docs/UniswapFactoryInterface.md @@ -1,6 +1,6 @@ # UniswapFactoryInterface.sol -View Source: [contracts/lib/UniswapFactoryInterface.sol](../contracts/lib/UniswapFactoryInterface.sol) +View Source: [contracts/interfaces/UniswapFactoryInterface.sol](../contracts/interfaces/UniswapFactoryInterface.sol) **UniswapFactoryInterface** @@ -95,7 +95,6 @@ function initializeFactory(address template) external nonpayable * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/docs/oToken.md b/docs/oToken.md index 2f5dae6..b5f99ae 100644 --- a/docs/oToken.md +++ b/docs/oToken.md @@ -191,7 +191,6 @@ function addAndSellERC20CollateralOption(uint256 amtToCreate, uint256 amtCollate * [ERC20Detailed](ERC20Detailed.md) * [ERC20Mintable](ERC20Mintable.md) * [IERC20](IERC20.md) -* [IOptionsExchange](IOptionsExchange.md) * [LibNote](LibNote.md) * [Migrations](Migrations.md) * [MinterRole](MinterRole.md) diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index 44dbbfb..d710939 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -2,52 +2,69 @@ const OptionsFactory = artifacts.require('OptionsFactory.sol'); const StringComparator = artifacts.require('StringComparator.sol'); const OptionsExchange = artifacts.require('OptionsExchange.sol'); const MockCompoundOracle = artifacts.require('MockCompoundOracle'); -const Oracle = artifacts.require('Oracle.sol'); const MockUniswapFactory = artifacts.require('MockUniswapFactory'); -module.exports = function (deployer, network) { +module.exports = function(deployer, network) { deployer.then(async () => { - var uniswapFactoryAddr; - var compoundOracleAddress; - var compoundOracle; + let uniswapFactoryAddr; + let compoundOracle; - if (network == "rinkeby") { + if (network == 'rinkeby') { // Rinkeby - uniswapFactoryAddr = "0xf5D915570BC477f9B8D6C0E980aA81757A3AaC36"; - compoundOracleAddress = "0x332b6e69f21acdba5fb3e8dac56ff81878527e06"; + uniswapFactoryAddr = '0xf5D915570BC477f9B8D6C0E980aA81757A3AaC36'; + compoundOracleAddress = '0x332b6e69f21acdba5fb3e8dac56ff81878527e06'; // compoundOracle = await deployer.deploy(Oracle, compoundOracleAddress); compoundOracle = await deployer.deploy(MockCompoundOracle); - console.log("Oracle Address ", compoundOracle.address.toString()); + console.log('Oracle Address ', compoundOracle.address.toString()); - const optionsExchange = await deployer.deploy(OptionsExchange, uniswapFactoryAddr); - console.log("Options Exchange ", optionsExchange.address.toString()); - await deployer.deploy(OptionsFactory, optionsExchange.address, compoundOracle.address); - console.log("Options Factory ", OptionsFactory.address.toString()); - } - else if (network == "kovan") { + const optionsExchange = await deployer.deploy( + OptionsExchange, + uniswapFactoryAddr + ); + console.log('Options Exchange ', optionsExchange.address.toString()); + await deployer.deploy( + OptionsFactory, + optionsExchange.address, + compoundOracle.address + ); + console.log('Options Factory ', OptionsFactory.address.toString()); + } else if (network == 'kovan') { await deployer.deploy(StringComparator); await deployer.link(StringComparator, OptionsFactory); // Kovan - uniswapFactoryAddr = "0xD3E51Ef092B2845f10401a0159B2B96e8B6c3D30"; - compoundOracleAddress = "0x6998ed7daf969ea0950e01071aceeee54cccbab5"; + uniswapFactoryAddr = '0xD3E51Ef092B2845f10401a0159B2B96e8B6c3D30'; + compoundOracleAddress = '0x6998ed7daf969ea0950e01071aceeee54cccbab5'; // compoundOracle = await deployer.deploy(Oracle, compoundOracleAddress); compoundOracle = await deployer.deploy(MockCompoundOracle); - const optionsExchange = await deployer.deploy(OptionsExchange, uniswapFactoryAddr); - await deployer.deploy(OptionsFactory, optionsExchange.address, compoundOracle.address); - } - else if (network == "ropsten") { + const optionsExchange = await deployer.deploy( + OptionsExchange, + uniswapFactoryAddr + ); + await deployer.deploy( + OptionsFactory, + optionsExchange.address, + compoundOracle.address + ); + } else if (network == 'ropsten') { await deployer.deploy(StringComparator); await deployer.link(StringComparator, OptionsFactory); // Ropsten - uniswapFactoryAddr = "0x0865A608E75FbD2ba087d08A5C7cAabcd977C1aD"; - compoundOracleAddress = "0xc7E20CF485b8E0Bcec3e2fCc23e3aD93b1b0cB39"; + uniswapFactoryAddr = '0x0865A608E75FbD2ba087d08A5C7cAabcd977C1aD'; + compoundOracleAddress = '0xc7E20CF485b8E0Bcec3e2fCc23e3aD93b1b0cB39'; // compoundOracle = await deployer.deploy(Oracle, compoundOracleAddress); compoundOracle = await deployer.deploy(MockCompoundOracle); - const optionsExchange = await deployer.deploy(OptionsExchange, uniswapFactoryAddr); - await deployer.deploy(OptionsFactory, optionsExchange.address, compoundOracle.address); - } else if (network == "mainnet") { + const optionsExchange = await deployer.deploy( + OptionsExchange, + uniswapFactoryAddr + ); + await deployer.deploy( + OptionsFactory, + optionsExchange.address, + compoundOracle.address + ); + } else if (network == 'mainnet') { // await deployer.deploy(StringComparator); // await deployer.link(StringComparator, OptionsFactory); // // Mainnet @@ -56,7 +73,6 @@ module.exports = function (deployer, network) { // compoundOracle = await deployer.deploy(Oracle, compoundOracleAddress); // // compoundOracle = await Oracle.at('0x317166AB2bF19152D16871C8Cf1B33583e26932B'); // console.log("Oracle Address ", compoundOracle.address.toString()); - // const optionsExchange = await deployer.deploy(OptionsExchange, uniswapFactoryAddr); // console.log("Options Exchange ", optionsExchange.address.toString()); // await deployer.deploy(OptionsFactory, optionsExchange.address, compoundOracle.address); @@ -70,8 +86,15 @@ module.exports = function (deployer, network) { uniswapFactoryAddr = uniswapFactory.address; compoundOracle = await deployer.deploy(MockCompoundOracle); - const optionsExchange = await deployer.deploy(OptionsExchange, uniswapFactoryAddr); - await deployer.deploy(OptionsFactory, optionsExchange.address, compoundOracle.address); + const optionsExchange = await deployer.deploy( + OptionsExchange, + uniswapFactoryAddr + ); + await deployer.deploy( + OptionsFactory, + optionsExchange.address, + compoundOracle.address + ); } - }) + }); };