Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFP12] CToken Cleanup #152

Merged
merged 29 commits into from Jun 7, 2022
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5a8c41d
Upgrade Contracts to 0.8.6
arjun-io Jul 22, 2021
bbd14c9
Remove CToken SafeMath, use Custom Errors
arjun-io Aug 29, 2021
46ee4cd
EnterExitMarkets.scen fixes
arjun-io Aug 29, 2021
c6dc5b2
Borrow.scen fixes
arjun-io Aug 29, 2021
1d71611
Update CI and Dockerfile Solidity version
arjun-io Aug 29, 2021
018f227
Increase memory available for CI
arjun-io Aug 30, 2021
8265286
gasCosts
arjun-io Aug 31, 2021
6313621
Remove *LocalVar structs
arjun-io Aug 31, 2021
b7c1361
clean up proposalID
arjun-io Sep 4, 2021
55daa66
pull in punitive accounting
kbrizzle Sep 12, 2021
c945f35
comments
arjun-io Sep 14, 2021
14c0f7c
audit remediations
arjun-io Oct 11, 2021
4a54ec5
further remediations
arjun-io Oct 26, 2021
42e6d56
Merge remote-tracking branch 'upstream/master' into rfp12-ctoken-cleanup
arjun-io Dec 1, 2021
01948c6
compilation fixes after master merge
arjun-io Dec 1, 2021
3a50927
Partial Fix: L03 - Gas inefficiencies
arjun-io Mar 11, 2022
fa51595
Partial Fix: L05 - Missing or erroneous docstrings and comments
arjun-io Mar 11, 2022
8ad1367
Partial Fix: L08 - Unreachable code
arjun-io Mar 11, 2022
56efb6b
var type
arjun-io Mar 11, 2022
bc6cca4
remove unused accrue interest custom errors
arjun-io Mar 16, 2022
8d79b11
Partial Fix: N13 - Typos
arjun-io Mar 11, 2022
442519e
Fix L07: Outdated Solidity versions
arjun-io Mar 23, 2022
30c5c1b
Merge pull request #5 from equilibria-xyz/l07
arjun-io Mar 26, 2022
4e5f455
Merge pull request #4 from equilibria-xyz/n13
arjun-io Mar 26, 2022
1687c56
Merge pull request #3 from equilibria-xyz/l08
arjun-io Mar 26, 2022
57385cb
Merge pull request #2 from equilibria-xyz/l05
arjun-io Mar 26, 2022
079d62f
Merge pull request #1 from equilibria-xyz/l03
arjun-io Mar 26, 2022
ace50b8
use solhint over solium
arjun-io Jun 2, 2022
de2329e
debug CI
arjun-io Jun 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions contracts/CToken.sol
Expand Up @@ -540,11 +540,10 @@ abstract contract CToken is CTokenInterface, ExponentialNoError, TokenErrorRepor
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)


/*
* We calculate the new total supply and redeemer balance, checking for underflow:
* totalSupplyNew = totalSupply - redeemTokens
* accountTokensNew = accountTokens[redeemer] - redeemTokens
* And write calculated values into storage
* We write the previously calculated values into storage.
* Note: Avoid token reentrancy attacks by writing reduced supply before external transfer.
*/
totalSupply = totalSupply - redeemTokens;
accountTokens[redeemer] = accountTokens[redeemer] - redeemTokens;
Expand Down Expand Up @@ -613,7 +612,10 @@ abstract contract CToken is CTokenInterface, ExponentialNoError, TokenErrorRepor
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)

/* We write the previously calculated values into storage */
/*
* We write the previously calculated values into storage.
* Note: Avoid token reentrancy attacks by writing increased borrow before external transfer.
`*/
jflatow marked this conversation as resolved.
Show resolved Hide resolved
accountBorrows[borrower].principal = accountBorrowsNew;
accountBorrows[borrower].interestIndex = borrowIndex;
totalBorrows = totalBorrowsNew;
Expand Down