-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor v1 tests folder structure (#137)
* Remove gas option to avoid coverage failure * Update cicd script * Move interfaces to interfaces/ (#139) * Enable coverage * WIP refactor tests (#138) * Create helper file for common functions * Unify describe message for all option parameter tests * Put new series test into folder series/
- Loading branch information
1 parent
4bbc898
commit aab6a54
Showing
37 changed files
with
835 additions
and
1,025 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
version: 2.1 | ||
#orbs: | ||
# coveralls: coveralls/[email protected] | ||
orbs: | ||
coveralls: coveralls/[email protected] | ||
|
||
workflows: | ||
build-test-report: | ||
jobs: | ||
- build | ||
- test: | ||
requires: | ||
- build | ||
|
||
jobs: | ||
build: | ||
working_directory: ~/optionsprotocol | ||
docker: | ||
- image: circleci/node:10.18.0 | ||
- image: trufflesuite/ganache-cli:v6.7.0 | ||
command: ganache-cli --deterministic -e 300 -p 8545 -m 'candy maple cake sugar pudding cream honey rich smooth crumble sweet treat' --accounts 30 --allowUnlimitedContractSize | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
|
@@ -18,6 +25,23 @@ jobs: | |
- run: | ||
name: Lint Contracts | ||
command: npm run lint:sol | ||
- run: | ||
name: Build types | ||
command: npm run build | ||
- save_cache: | ||
key: dependency-cache-{{ checksum "package.json" }} | ||
paths: | ||
- node_modules | ||
test: | ||
working_directory: ~/optionsprotocol | ||
docker: | ||
- image: circleci/node:10.18.0 | ||
- image: trufflesuite/ganache-cli:v6.7.0 | ||
command: ganache-cli --deterministic -e 300 -p 8545 -m 'candy maple cake sugar pudding cream honey rich smooth crumble sweet treat' --accounts 30 --allowUnlimitedContractSize | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
key: dependency-cache-{{ checksum "package.json" }} | ||
- run: | ||
name: Deploy Contracts | ||
command: npm run deploy:development | ||
|
@@ -27,17 +51,13 @@ jobs: | |
- store_artifacts: | ||
path: /test_output | ||
# NOTE -> This requires a paid CircleCI plan to increase the RAM size up to 6/8GB. Fails at current | ||
#- run: | ||
# name: Produce Coverage Report | ||
# command: npm run coverage | ||
#- coveralls/upload | ||
#- store_artifacts: | ||
# path: /coverage | ||
#- store_artifacts: | ||
# path: /.coverage.json | ||
- save_cache: | ||
key: dependency-cache-{{ checksum "package.json" }} | ||
paths: | ||
- node_modules | ||
|
||
- run: | ||
name: Produce Coverage Report | ||
command: npm run coverage | ||
- coveralls/upload | ||
- store_artifacts: | ||
path: /coverage | ||
- store_artifacts: | ||
path: /.coverage.json | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ build/ | |
flattened/ | ||
.idea | ||
secret.js | ||
coverage/ | ||
coverage/ | ||
coverage.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
pragma solidity ^0.5.10; | ||
|
||
|
||
contract CTokenInterface { | ||
/*** User Interface ***/ | ||
address public underlying; | ||
uint256 public initialExchangeRateMantissa; | ||
|
||
function transfer(address dst, uint256 amount) external returns (bool); | ||
|
||
function transferFrom( | ||
address src, | ||
address dst, | ||
uint256 amount | ||
) external returns (bool); | ||
|
||
function approve(address spender, uint256 amount) external returns (bool); | ||
|
||
function allowance(address owner, address spender) | ||
external | ||
view | ||
returns (uint256); | ||
|
||
function balanceOf(address owner) external view returns (uint256); | ||
|
||
function balanceOfUnderlying(address owner) external returns (uint256); | ||
|
||
function getAccountSnapshot(address account) | ||
external | ||
view | ||
returns ( | ||
uint256, | ||
uint256, | ||
uint256, | ||
uint256 | ||
); | ||
|
||
function borrowRatePerBlock() external view returns (uint256); | ||
|
||
function supplyRatePerBlock() external view returns (uint256); | ||
|
||
function totalBorrowsCurrent() external returns (uint256); | ||
|
||
function borrowBalanceCurrent(address account) external returns (uint256); | ||
|
||
function borrowBalanceStored(address account) public view returns (uint256); | ||
|
||
function exchangeRateCurrent() public returns (uint256); | ||
|
||
function exchangeRateStored() public view returns (uint256); | ||
|
||
function getCash() external view returns (uint256); | ||
|
||
function accrueInterest() public returns (uint256); | ||
|
||
function seize( | ||
address liquidator, | ||
address borrower, | ||
uint256 seizeTokens | ||
) external returns (uint256); | ||
} |
24 changes: 12 additions & 12 deletions
24
contracts/lib/CompoundOracleInterface.sol → ...ts/interfaces/CompoundOracleInterface.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
pragma solidity ^0.5.0; | ||
pragma solidity ^0.5.10; | ||
// AT MAINNET ADDRESS: 0x02557a5E05DeFeFFD4cAe6D83eA3d173B272c904 | ||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
|
||
contract CompoundOracleInterface { | ||
// returns asset:eth -- to get USDC:eth, have to do 10**24/result, | ||
|
||
|
||
constructor() public { | ||
} | ||
constructor() public {} | ||
|
||
/** | ||
* @notice retrieves price of an asset | ||
* @dev function to get price for an asset | ||
* @param asset Asset for which to get the price | ||
* @return uint mantissa of asset price (scaled by 1e18) or zero if unset or contract paused | ||
*/ | ||
function getPrice(address asset) public view returns (uint); | ||
function getUnderlyingPrice(ERC20 cToken) public view returns (uint); | ||
* @notice retrieves price of an asset | ||
* @dev function to get price for an asset | ||
* @param asset Asset for which to get the price | ||
* @return uint mantissa of asset price (scaled by 1e18) or zero if unset or contract paused | ||
*/ | ||
function getPrice(address asset) public view returns (uint256); | ||
|
||
function getUnderlyingPrice(ERC20 cToken) public view returns (uint256); | ||
// function getPrice(address asset) public view returns (uint) { | ||
// return 527557000000000; | ||
// } | ||
|
||
} |
Oops, something went wrong.