Skip to content
This repository has been archived by the owner on May 15, 2021. It is now read-only.

Fixed OZ March 7 audit C01: Supply is Manipulable #2

Merged
merged 19 commits into from Apr 2, 2020
Merged

Conversation

asselstine
Copy link
Contributor

Neglected to reduce supply when user withdraws their pending deposit.

Neglected to reduce supply when user withdraws their pending deposit.
Fixed
There was an egregious mistake trying to transfer collateral tokens from
the *operator* on deposit.  Test had the same bug!
Overrode `send`, `transfer`, and `transferFrom` with versions that
consolidate the users balance before calling the superclass function.

Fixes M01
Removed return value from ScheduledBalance#clearConsolidated

Fixes L01
After reviewing the audit and code, discovered the invariant that the committed draw
exchange rate *is always known*, so there was no need to track previous
/ current deposits for a user.

Fixes L03
Removed ExchangeRateTracker#currentExchangeRateMantissa

Retained the tokenToCollateralValue and collateralTokenToValue functions
for convenience and gas efficiency (they don't run `search`).

Partially addresses issue N03
Added checks to ensure tracker is initialized only once

Fixes N04
Fixed some old documentation, and most of the typos identified.

"User's backing collateral" remained as it's a "possesive apostrophe".

:)

Fixes N06
Fixes OZ March 7 audit issue N06: Typographical errors
Fixes OZ March 7 audit issue N04: Reinitialize Exchange Rate Tracker
Fixes OZ March 7 audit issue N03: Duplicated Code
Fixes OZ March 7 Audit issue L03: Complicated Code
Fixes OZ March 7 audit issue L02: Misleading comments
Fixed OZ March 7 security audit issue L01: Missing Return Value
OZ March 7 security audit issue M01: Incomplete ERC777
Fixes OZ March 7 audit H01: Deposit uses operator collateral
@asselstine asselstine merged commit 306d2b1 into master Apr 2, 2020
@asselstine asselstine deleted the audit/C01 branch April 2, 2020 18:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant