Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
e414160
implement flashloan poc
0xyolo Feb 3, 2021
e52bbd1
add change logs
0xyolo Mar 3, 2021
7e287e0
Merge pull request #54 from CreamFi/read-me
jeremyHD Mar 4, 2021
f127a34
Add trail of bits audit report
jeremyHD Mar 10, 2021
0ded928
Merge pull request #56 from CreamFi/tob_audit
jeremyHD Mar 10, 2021
07d6e9d
Update Audit description in README
jeremyHD Mar 10, 2021
8ab3097
Fix typo in README
jeremyHD Mar 10, 2021
ff02e99
contracts/CCollateralCapErc20Delegate.sol: add new delegate
bun919tw Mar 8, 2021
2aee696
contracts/: add new delegator
bun919tw Mar 8, 2021
bf8568a
contracts/CCollateralCapErc20Delegator.sol: support collateral cap
bun919tw Mar 8, 2021
723ab35
scenario/, spec/, tests/: add tests for CCollateralCapErc20
bun919tw Mar 8, 2021
f2002ea
Implement TripleSlopeRateModel
jeremyHD Mar 12, 2021
9f4a922
make gulp nonReentrant
0xyolo Mar 15, 2021
49ae515
add feeBips comment
0xyolo Mar 15, 2021
f6a8a41
tests/: add more tests and some minor refactor
bun919tw Mar 16, 2021
98154b0
contracts/Lens/CompoundLens.sol: update lens for cToken version
bun919tw Mar 17, 2021
4819698
Merge pull request #57 from CreamFi/TripleSlopeRateModel
bun919tw Mar 18, 2021
72a2d76
spec/scenario/Gas.scen: add gas profiling
bun919tw Mar 19, 2021
c007c19
script/: add contract sizer
bun919tw Mar 19, 2021
64d1ddd
contracts/PriceOracleProxy.sol: add guardian for price oracle
bun919tw Mar 24, 2021
6b10e65
Merge branch 'master' into flashloan-poc
0xyolo Mar 26, 2021
9231ae3
Merge pull request #44 from CreamFi/flashloan-poc
bun919tw Mar 26, 2021
23a4ae9
Merge branch 'master' into collateral_cap
bun919tw Mar 26, 2021
dac84d1
Implement CWrappedNativeDelegator
jeremyHD Mar 31, 2021
88d22f0
Merge pull request #61 from CreamFi/CNativeDelegator
jeremyHD Apr 1, 2021
0d23116
update: totalBorrows
0xyolo Apr 8, 2021
e47b373
Merge pull request #62 from CreamFi/fix-flashloan
bun919tw Apr 8, 2021
816a3ec
Merge pull request #58 from CreamFi/price_oracle_proxy
bun919tw Apr 12, 2021
2019c5f
contracts/PriceOracleProxy.sol: support curve and vault tokens
bun919tw Apr 12, 2021
79526ef
tests/: fix tests for price oracle
bun919tw Apr 14, 2021
0cee54c
contracts/PriceOracleProxy.sol: curve token version
bun919tw Apr 14, 2021
d69405a
tests/: fix tests
bun919tw Apr 14, 2021
e7376cd
Merge pull request #63 from CreamFi/support_yvault_v2
bun919tw Apr 14, 2021
4d8af31
contracts/PriceOracleProxy.sol: fix typo
bun919tw Apr 15, 2021
8432602
Merge pull request #64 from CreamFi/typo
bun919tw Apr 15, 2021
b9dc2d4
contracts/PriceOracleProxy.sol: support aggregator USD based
bun919tw Apr 15, 2021
b9eae43
tests/PriceOracleProxyTest.js: fix tests
bun919tw Apr 15, 2021
e450daa
contracts/Comptroller.sol: support delist market
bun919tw Apr 19, 2021
d2a7858
tests/: fix tests
bun919tw Apr 19, 2021
a8cc7ed
Merge pull request #65 from CreamFi/change_chainlink_base
bun919tw Apr 19, 2021
1bdeb9c
Merge branch 'master' into collateral_cap
bun919tw Apr 21, 2021
2448b1e
contracts/CCollateralCapErc20.sol: update flashloan function
bun919tw Apr 21, 2021
f634f8f
contracts/: fix feedback
bun919tw Apr 22, 2021
00ad5d9
Merge pull request #66 from CreamFi/delist_market
bun919tw Apr 23, 2021
6f37fe2
spec/scenario/Gas.scen: update gas cost
bun919tw Apr 22, 2021
769bdfb
Merge branch 'master' into collateral_cap
bun919tw Apr 23, 2021
566deba
spec/scenario/Gas.scen: skip gas scen
bun919tw Apr 23, 2021
827015f
contracts/Comptroller.sol: minor refactor
bun919tw May 6, 2021
43fa030
Merge pull request #52 from CreamFi/collateral_cap
StanleyDing May 6, 2021
53f9060
contracts/Comptroller.sol: remove some comp rewards functions
bun919tw May 7, 2021
4acc89e
*: fix tests
bun919tw May 7, 2021
363543a
Merge pull request #69 from CreamFi/comptroller_slimming
bun919tw May 14, 2021
0ab891a
Add BSC and FTM network in saddle config
jeremyHD May 21, 2021
ed35cb4
Merge pull request #75 from CreamFi/saddle_config
bun919tw May 21, 2021
9bda53b
contracts/Lens/CompoundLens.sol: extend lens
bun919tw May 21, 2021
5319ca0
Merge pull request #76 from CreamFi/lens
jeremyHD May 21, 2021
5b3066b
contracts/: support collateral balance in lens
bun919tw May 24, 2021
73939e7
Merge pull request #77 from CreamFi/extend_lens
bun919tw May 24, 2021
e7de257
contracts/: add controll for flash loan
bun919tw May 28, 2021
d003995
tests/: add tests for flash loan switch
bun919tw May 28, 2021
faef6de
Merge pull request #79 from CreamFi/flashloan
bun919tw May 28, 2021
0f96c0e
contracts/: rename CCapableWrappedNativeDelegate to CWrappedNativeDel…
bun919tw Jun 1, 2021
3843f83
contracts/CWrappedNative.sol: copy from CErc20
bun919tw Jun 1, 2021
0e079dd
contracts/: modify internal function signature
bun919tw Jun 3, 2021
4d02f36
contracts/: modify CWrappedNative
bun919tw Jun 3, 2021
ceb2c24
contracts/: small changes
bun919tw Jun 8, 2021
4f3a8eb
scenario/, spec/, tests/: add tests for CWrappedNative
bun919tw Jun 9, 2021
37e878d
contracts/: update IRM with roof
bun919tw Jun 10, 2021
5104a1e
tests/: fix tests and remove old JumpRateModel
bun919tw Jun 10, 2021
897ae1d
contracts/: fix feedback
bun919tw Jun 10, 2021
56f6c89
Merge pull request #82 from CreamFi/irm
bun919tw Jun 10, 2021
6a35bc6
Merge pull request #81 from CreamFi/wrapped_native
bun919tw Jun 11, 2021
abffab4
tests/Tokens/mintAndRedeemCWrappedNativeTest.js: minor fix
bun919tw Jun 11, 2021
72f9d60
Merge pull request #87 from CreamFi/minor_fix
bun919tw Jun 11, 2021
73ba2b2
:contracts/Comptroller.sol: update rewards
bun919tw Jun 13, 2021
917af1d
Merge pull request #89 from CreamFi/update_comp_rewards
bun919tw Jun 13, 2021
d90e045
contracts/Comptroller.sol: fix rewards
bun919tw Jun 15, 2021
5773ad7
Merge pull request #90 from CreamFi/update_comp_rewards
StanleyDing Jun 15, 2021
3f72d90
contracts/Comptroller.sol: remove unnecessary calls
bun919tw Jun 15, 2021
192e9e6
Merge pull request #91 from CreamFi/update_comp_rewards
bun919tw Jun 15, 2021
5fa2ec8
contracts/: support LM
bun919tw Jun 30, 2021
7d1edbb
tests/Comptroller/comptrollerTest.js: add test for _setLiquidityMining
bun919tw Jun 30, 2021
e1200dd
Merge pull request #96 from CreamFi/lm
bun919tw Jul 1, 2021
65f11f1
contracts/: several changes
bun919tw Jul 1, 2021
ac98ffa
tests/: fix lens tests
bun919tw Jul 1, 2021
6098ab9
Merge pull request #97 from CreamFi/lens_support_cwrapped
bun919tw Jul 1, 2021
a70a0e1
README.md: update README.md
bun919tw Jul 1, 2021
89f9348
Merge pull request #100 from CreamFi/readme
bun919tw Jul 1, 2021
ea8461e
contracts/: add a check when a new LM is set
bun919tw Jul 13, 2021
b4123db
tests/: fix tests
bun919tw Jul 13, 2021
cb2e56a
Merge pull request #106 from CreamFi/lm
bun919tw Jul 13, 2021
bf29e63
contracts/Lens/CompoundLens.sol: clean up lens
bun919tw Jul 14, 2021
4939a94
tests/: fix tests
bun919tw Jul 14, 2021
2b1ba12
contracts/: use wrapped native token as cash
bun919tw Jul 14, 2021
dff23af
tests/: fix tests
bun919tw Jul 14, 2021
2b67117
contracts/CTokenAdmin.sol: add CTokenAdmin
bun919tw Jul 15, 2021
fb713d9
test/: add tests
bun919tw Jul 16, 2021
490b42a
Merge pull request #109 from CreamFi/ctoken_admin
bun919tw Jul 19, 2021
4f1502b
Merge pull request #107 from CreamFi/lens
bun919tw Jul 19, 2021
3cfb7bb
Merge pull request #108 from CreamFi/wrap
bun919tw Jul 19, 2021
e17e88c
spec/scenario/WrappedNative.scen: fix wrapped native tests
bun919tw Jul 19, 2021
2ae9123
Merge pull request #110 from CreamFi/fix_test
bun919tw Jul 19, 2021
73ed68b
contracts/Comptroller.sol: add isMarketListed
bun919tw Jul 21, 2021
b5528e6
Merge pull request #111 from CreamFi/utils
bun919tw Jul 21, 2021
746a24e
contracts/Comptroller.sol: hide lm related for now
bun919tw Jul 30, 2021
1e67060
Merge pull request #113 from CreamFi/remove_lm
jeremyHD Jul 30, 2021
3f1fbe6
contracts/CTokenAdmin.sol: remove reserve manager from constructor
bun919tw Aug 4, 2021
bc96866
tests/: fix tests for cTokenAdmin
bun919tw Aug 4, 2021
e2b0fcd
Merge pull request #114 from CreamFi/ctoken_admin
bun919tw Aug 4, 2021
fbb7320
contracts/Comptroller.sol: skip unnecessary calculation
bun919tw Aug 9, 2021
5db34e2
tests/Comptroller/accountLiquidityTest.js: fix test
bun919tw Aug 9, 2021
2edc9cf
Merge pull request #116 from CreamFi/gas
bun919tw Aug 11, 2021
40ba69a
add github action
stitetsati Aug 12, 2021
5c9ccc3
Merge pull request #118 from CreamFi/feature-formatter
bun919tw Aug 13, 2021
8e393cc
contracts/: change code structure
bun919tw Aug 9, 2021
990842b
contracts/PriceOracle/: refactor price oracle
bun919tw Aug 10, 2021
c58b085
tests/: fix test for price oracle
bun919tw Aug 11, 2021
1f8ec56
contracts/PriceOracle/PriceOracleProxy.sol: handle BTC
bun919tw Aug 12, 2021
f7a76bc
tests/PriceOracleProxyTest.js: fix tests
bun919tw Aug 12, 2021
bc51ea5
contracts/PriceOracle/: formatting
bun919tw Aug 13, 2021
600d149
implemented flash loan lender to comply with erc3156
stitetsati Aug 13, 2021
92f1aa3
Merge pull request #105 from CreamFi/feature-eip-3156
stitetsati Aug 16, 2021
5293ab2
bypass crEther after getAllMarkets in FlashloanLender
stitetsati Aug 16, 2021
5278bb3
Merge pull request #120 from CreamFi/feature-flashloan-update
bun919tw Aug 16, 2021
9068b98
Merge pull request #117 from CreamFi/price_oracle
bun919tw Aug 17, 2021
84e86f5
tests/: add MockAggregator back
bun919tw Aug 19, 2021
8bcea63
Merge pull request #121 from CreamFi/mock_registry
bun919tw Aug 19, 2021
8888697
contracts/PriceOracle/PriceOracleProxy.sol: minor refactor
bun919tw Aug 23, 2021
296ec54
Merge pull request #123 from CreamFi/price_oracle_minor_refactor
bun919tw Aug 23, 2021
0205c92
tests/: minor fix
bun919tw Aug 24, 2021
23214f6
Merge pull request #124 from CreamFi/price_oracle_minor_refactor
bun919tw Aug 24, 2021
da25143
contracts/, tests/: handle erc777
bun919tw Sep 3, 2021
178ce8f
contracts/, tests/: restore verify hooks
bun919tw Aug 31, 2021
c8e33a8
Merge pull request #131 from CreamFi/restore_verify_hook
bun919tw Sep 17, 2021
b709d39
Merge pull request #132 from CreamFi/handle_erc777
bun919tw Sep 17, 2021
f98b0cf
contracts/: refactor code structure
bun919tw Sep 28, 2021
7c1bb78
Merge pull request #140 from CreamFi/add_legacy
bun919tw Sep 29, 2021
06ebb99
contract/: add CToken check repay
bun919tw Oct 1, 2021
572496d
contracts/: add protection for reenty liquidation attack for erc777
bun919tw Oct 6, 2021
1b80ad0
tests/: add tests
bun919tw Oct 6, 2021
78ed154
Merge pull request #143 from CreamFi/enhance_crAmp
bun919tw Oct 8, 2021
f4e5e33
contracts/FlashloanLender.sol: add transferOwnership
bun919tw Oct 12, 2021
7ae4ccd
Merge pull request #146 from CreamFi/flash_loan_lender
bun919tw Oct 18, 2021
2f3cc44
README.md: update readme
bun919tw Oct 22, 2021
2586166
contracts/CToken.sol: fix 0 amount
bun919tw Nov 19, 2021
2bb3ade
Merge pull request #150 from CreamFi/fix_zero_repay
bun919tw Nov 19, 2021
54320ca
contracts/CTokenCheckRepay.sol: remove zero amount check
bun919tw Nov 26, 2021
2d8995f
contracts/: revert if anything went wrong
bun919tw Nov 30, 2021
71a854c
spec/, tests/: fix tests
bun919tw Nov 30, 2021
90da68c
Merge pull request #148 from CreamFi/readme
jeremyHD Dec 6, 2021
e314758
src/: fix feedback
bun919tw Dec 6, 2021
1901ed0
contracts/CCollateralCapErc20.sol: redeemAllowed
bun919tw Dec 6, 2021
d6c0134
contracts/Comptroller.sol: revert if anything wrong
bun919tw Dec 6, 2021
bdeeb94
*: fix tests
bun919tw Dec 6, 2021
4de64ac
Merge pull request #152 from CreamFi/enhance
bun919tw Dec 13, 2021
b4c1ec0
contracts/CToken.sol: use wrapped token in reduce reserve
bun919tw Dec 15, 2021
778372d
Merge pull request #155 from CreamFi/reduce_reserves
bun919tw Dec 15, 2021
b5a82b9
contracts/: shorten revert message
jeremyHD Dec 16, 2021
caf7cdf
spec/, tests/: fix tests
bun919tw Dec 17, 2021
335a7c8
Merge pull request #156 from CreamFi/slim_contract_size
bun919tw Dec 17, 2021
4838fb6
*: make CWrappedNative interface consistent with CCollateralCap
bun919tw Feb 7, 2022
2517556
Merge pull request #167 from CreamFi/cwrapped_collateral_cap
jeremyHD Feb 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,23 @@ jobs:
- attach_workspace:
at: ~/repo
- run: yarn run lint

format:
docker:
- image: circleci/node:13
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v3-dependencies-{{ checksum "yarn.lock" }}
- run: yarn install || (yarn cache clean && yarn install)
- save_cache:
paths:
- node_modules
key: v3-dependencies-{{ checksum "yarn.lock" }}
- attach_workspace:
at: ~/repo
- run: yarn run prettier '**/**/*.sol' -c
docker:
docker:
- image: cimg/go:1.13
Expand Down Expand Up @@ -187,4 +203,5 @@ workflows:
jobs:
- test
- lint
- format
- verify
15 changes: 15 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false,
"explicitTypes": "always"
}
}
]
}
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,67 @@ Testing
Jest contract tests are defined under the [tests directory](https://github.com/compound-finance/compound-protocol/tree/master/tests). To run the tests run:

yarn test

Branch
------
[master](https://github.com/CreamFi/compound-protocol/tree/master) - deployed on ethereum mainnet

[bsc](https://github.com/CreamFi/compound-protocol/tree/bsc) - deployed on binance smart chain

[cream-v2](https://github.com/CreamFi/compound-protocol/tree/cream-v2) - (ironbank) deployed on ethereum mainnet

[fantom_time_based](https://github.com/CreamFi/compound-protocol/tree/fantom_time_based) - deployed on fantom opera

[polygon](https://github.com/CreamFi/compound-protocol/tree/polygon) - depolyed on polygon

[arbitrum](https://github.com/CreamFi/compound-protocol/tree/arbitrum) - deployed on arbitrum

[avalanche](https://github.com/CreamFi/compound-protocol/tree/avalanche) - deployed on avalanche

Audits
-------
C.R.E.A.M. Finance smart contracts have been audited by Trail of Bits. The audit report is available on Trail of Bits [publications repo](https://github.com/trailofbits/publications/blob/master/reviews/CREAMSummary.pdf).

Change Logs
-----------
C.R.E.A.M. Finance forked from this commit [7561dcf5964527dbf2f3c7cd670775b3c6f7e378](https://github.com/compound-finance/compound-protocol/commits/7561dcf5964527dbf2f3c7cd670775b3c6f7e378) of Compound Finance,
Cream continues to add new features and submits pull requests back to Compound as appropriate. Below is a high level summary of the changes:

- Add borrow cap feature, this feature is cherry picked from Compound Finance https://github.com/compound-finance/compound-protocol/pull/65
* Add a borrow cap check in Comptroller's borrowAllowed hook, disallow further borrowing if an market's totalBorrows reaches its borrow cap

- Add supply cap feature, implemented in Comptroller.sol, CCapableErc20.sol
* Add a supply cap check in Comptroller's mintAllowed hook, disallow further minting (supplying) if an market's cash + totalBorrows reaches its supply cap
* CCapableErc20 tracks cash by itself instead of using balanceOf of underlying token. This avoids direct transfering to cToken to manipulate cash.
* Need to update cToken's implementation to enable this feature.

- Add collateral cap feature, implemented in Comptroller.sol, CCollateralCapErc20.sol
* Add a collateral cap to determine the maximum balance to be considered as collateral. If the cap is reached, users could still supply the asset but it can't be used as collateral.
* The maximum borrow power of this kind of asset is roughly collateralCap * collateralFactor.
* Need to update cToken's implementation to enable this feature.

- Add CWrappedNative to replace old CEther
* CWrappedNative could support both the native token and the wrapped native token.
* Users could choose the native token or the wrapped native token when supplying / borrowing / redeeming / repaying.

- Support earning sushi LP tokens. Implemented in CSLPDelegate.sol
* CSLP deposit/withdraw sushi lp token to/from sushi MasterChef when doTransferIn/doTrasnferOut
* Suppliers can use sushi LP tokens as collateral
* Suppliers can claim sushi reward or borrow interest

- Support claiming COMP earned from holding CTokens. Implemented in CCTokenDelegate.sol
* CCToken collects Compound reward and supplier can use claimComp function to claim their reward

BSC
- Update price oracle implementation to support BAND.
- Support protocol to protocol borrowing without collateral, this gives whitelisted protocol borrows up to credit limit without collateral.
* add credit limit in Comptroller.sol
* When setup a credit limit, it also needs to specify the borrow markets.

IronBank
- Support protocol to protocol borrowing without collateral, this gives whitelisted protocol borrows up to credit limit without collateral.
* add credit limit in Comptroller.sol
* remove repayBorrowBehalf, so that protocol can track their debt easily.
- Patch as part of the update in the Alpha Homora v2 exploit, excluding stolen funds from interest calculation.
* CToken.sol on cream-v2-no-interest branch
* Apply on cyWETH, cyUSDC, cyUSDT, cyDAI
Binary file added audits/trailofbits-CREAMSummary.pdf
Binary file not shown.
Loading