From ffab3cd1d946be1ceeeeecfd66cff9140ca305f0 Mon Sep 17 00:00:00 2001 From: mkflow27 Date: Mon, 29 Jul 2024 14:39:31 +0200 Subject: [PATCH 1/3] sUSX Rate Providers Fixes #102 --- rate-providers/registry.json | 29 ++++++++++++- rate-providers/sUSXRateProvider.md | 66 ++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 rate-providers/sUSXRateProvider.md diff --git a/rate-providers/registry.json b/rate-providers/registry.json index d111948..9931204 100644 --- a/rate-providers/registry.json +++ b/rate-providers/registry.json @@ -366,6 +366,20 @@ "implementationReviewed": "0x9093939b9bdc5322d6e2b37b62867d744c98e874" } ] + }, + "0xf7ec24690fBCEc489E7C9A7055C04Db5C221c397": { + "asset": "0xbC404429558292eE2D769E57d57D6E74bbd2792d", + "name": "ERC4626RateProvider", + "summary": "safe", + "review": "./sUSXRateProvider.md", + "warnings": [], + "factory": "", + "upgradeableComponents": [ + { + "entrypoint": "0xbC404429558292eE2D769E57d57D6E74bbd2792d", + "implementationReviewed": "0x339B34965bD3A61025eEA3D5FDcADf75756cc0Db" + } + ] } }, "avalanche": { @@ -1208,6 +1222,20 @@ "warnings": ["chainlink"], "factory": "0x1311Fbc9F60359639174c1e7cC2032DbDb5Cc4d1", "upgradeableComponents": [] + }, + "0xc497F11326c3DE5086710EDa43354697b32c1541": { + "asset": "0xbC404429558292eE2D769E57d57D6E74bbd2792d", + "name": "ERC4626RateProvider", + "summary": "safe", + "review": "./sUSXRateProvider.md", + "warnings": [], + "factory": "", + "upgradeableComponents": [ + { + "entrypoint": "0xbC404429558292eE2D769E57d57D6E74bbd2792d", + "implementationReviewed": "0xC80aD49191113d31fe52427c01A197106ef5EB5b" + } + ] } }, "fantom": { @@ -1278,7 +1306,6 @@ } ] } - }, "gnosis": { "0x89C80A4540A00b5270347E02e2E144c71da2EceD": { diff --git a/rate-providers/sUSXRateProvider.md b/rate-providers/sUSXRateProvider.md new file mode 100644 index 0000000..649bc24 --- /dev/null +++ b/rate-providers/sUSXRateProvider.md @@ -0,0 +1,66 @@ +# Rate Provider: `ERC4626RateProvider` + +## Details +- Reviewed by: @mkflow27 +- Checked by: @\ +- Deployed at: + - [ethereum:0xc497F11326c3DE5086710EDa43354697b32c1541](https://etherscan.io/address/0xc497F11326c3DE5086710EDa43354697b32c1541) + - [arbitrum:0xf7ec24690fBCEc489E7C9A7055C04Db5C221c397](https://arbiscan.io/address/0xf7ec24690fBCEc489E7C9A7055C04Db5C221c397) +- Audit report(s): + - [dForce Lending](https://github.com/dforce-network/documents/tree/master/audit_report/Lending) + +## Context +sUSX is based on dForce's usx stablecoin. It is a yield-bearing version which accrues protocol fees from lending operations (Unitus protocol), Minting Fees from usx minting, redemption fees from converting usx back to underlying collateral, defi operations and other strategies. The rate of susx -> usx is reported by an ERC4626 rate provider. + +## Review Checklist: Bare Minimum Compatibility +Each of the items below represents an absolute requirement for the Rate Provider. If any of these is unchecked, the Rate Provider is unfit to use. + +- [x] Implements the [`IRateProvider`](https://github.com/balancer/balancer-v2-monorepo/blob/bc3b3fee6e13e01d2efe610ed8118fdb74dfc1f2/pkg/interfaces/contracts/pool-utils/IRateProvider.sol) interface. +- [x] `getRate` returns an 18-decimal fixed point number (i.e., 1 == 1e18) regardless of underlying token decimals. + +## Review Checklist: Common Findings +Each of the items below represents a common red flag found in Rate Provider contracts. + +If none of these is checked, then this might be a pretty great Rate Provider! If any of these is checked, we must thoroughly elaborate on the conditions that lead to the potential issue. Decision points are not binary; a Rate Provider can be safe despite these boxes being checked. A check simply indicates that thorough vetting is required in a specific area, and this vetting should be used to inform a holistic analysis of the Rate Provider. + +### Administrative Privileges +- [ ] The Rate Provider is upgradeable (e.g., via a proxy architecture or an `onlyOwner` function that updates the price source address). + +- [x] Some other portion of the price pipeline is upgradeable (e.g., the token itself, an oracle, or some piece of a larger system that tracks the price). + #### sUSX on mainnet + - upgradeable component: `sUSX` ([ethereum:0xbC404429558292eE2D769E57d57D6E74bbd2792d](https://etherscan.io/address/0xbC404429558292eE2D769E57d57D6E74bbd2792d#code)) + - admin address: [ethereum:0x145c79A1F0e1Ad5ad7fC8d99548a02A07B24F8FD](https://etherscan.io/address/0x145c79A1F0e1Ad5ad7fC8d99548a02A07B24F8FD#code) + - admin type: multisig + - multisig threshold/signers: 3/5 + #### sUSX on Arbitrum + - upgradeable component: `sUSX` ([arbitrum:0xbC404429558292eE2D769E57d57D6E74bbd2792d](https://arbiscan.io/address/0xbC404429558292eE2D769E57d57D6E74bbd2792d#code)) + - admin address: [arbitrum:0x9d82033BB36217B44567edC635bE926f74D1b76f](https://arbiscan.io/address/0x9d82033BB36217B44567edC635bE926f74D1b76f) + - admin type: multisig + - multisig threshold/signers: 3/5 + +### Oracles +- [x] Price data is provided by an off-chain source (e.g., a Chainlink oracle, a multisig, or a network of nodes). + - source: Multisig + - source address: + #### Oracle on mainnet (3/5) + - [ethereum:0x145c79A1F0e1Ad5ad7fC8d99548a02A07B24F8FD](https://etherscan.io/address/0x145c79A1F0e1Ad5ad7fC8d99548a02A07B24F8FD) + #### Oracle on arbitrum (3/5) + - [arbitrum:0x9d82033BB36217B44567edC635bE926f74D1b76f](https://arbiscan.io/address/0x9d82033BB36217B44567edC635bE926f74D1b76f) + - any protections? YES: the new rate is based on a `_newUsr` value being pushed to the `usrConfigs` array, which is being read during the rate computation. The values are pushed as part of the permission call to `_addNewUsrConfig`. Various checks are in place to ensure resulting rates are bound to certain increasing/decreasing threshold levels. This includes: + - New epoch start times needing to be equal to or greater then the current block.timestamp + - new epoch start time needing to be greater or equal than the last epoch end time + - and `newUsr >= MIN_USR && _newUsr <= MAX_USR` as a requirement. + These checks ensure the rate change is bound to be within acceptable intervals. + +- [ ] Price data is expected to be volatile (e.g., because it represents an open market price instead of a (mostly) monotonically increasing price). + +### Common Manipulation Vectors +- [ ] The Rate Provider is susceptible to donation attacks. + +## Additional Findings +To save time, we do not bother pointing out low-severity/informational issues or gas optimizations (unless the gas usage is particularly egregious). Instead, we focus only on high- and medium-severity findings which materially impact the contract's functionality and could harm users. + +## Conclusion +**Summary judgment: USABLE/** + +These rate providers are usable with Balancer pools. The system upgradeability is behind a 3/5 multisig and oracle state updates are permissioned (3/5 multisig) as well as validity checks are done on the data being pushed by the oracle. From b7acd02d2d51d25f118d19edabe04ae939a67e88 Mon Sep 17 00:00:00 2001 From: mkflow27 Date: Wed, 31 Jul 2024 14:41:55 +0200 Subject: [PATCH 2/3] sUSX Rate Providers Fixes #102 --- rate-providers/registry.json | 4 ++-- rate-providers/sUSXRateProvider.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rate-providers/registry.json b/rate-providers/registry.json index 9931204..cf939ef 100644 --- a/rate-providers/registry.json +++ b/rate-providers/registry.json @@ -373,7 +373,7 @@ "summary": "safe", "review": "./sUSXRateProvider.md", "warnings": [], - "factory": "", + "factory": "0xe548a29631f9E49830bE8edc22d407b2D2915F31", "upgradeableComponents": [ { "entrypoint": "0xbC404429558292eE2D769E57d57D6E74bbd2792d", @@ -1229,7 +1229,7 @@ "summary": "safe", "review": "./sUSXRateProvider.md", "warnings": [], - "factory": "", + "factory": "0xFC541f8d8c5e907E236C8931F0Df9F58e0C259Ec", "upgradeableComponents": [ { "entrypoint": "0xbC404429558292eE2D769E57d57D6E74bbd2792d", diff --git a/rate-providers/sUSXRateProvider.md b/rate-providers/sUSXRateProvider.md index 649bc24..455b27e 100644 --- a/rate-providers/sUSXRateProvider.md +++ b/rate-providers/sUSXRateProvider.md @@ -46,7 +46,7 @@ If none of these is checked, then this might be a pretty great Rate Provider! If - [ethereum:0x145c79A1F0e1Ad5ad7fC8d99548a02A07B24F8FD](https://etherscan.io/address/0x145c79A1F0e1Ad5ad7fC8d99548a02A07B24F8FD) #### Oracle on arbitrum (3/5) - [arbitrum:0x9d82033BB36217B44567edC635bE926f74D1b76f](https://arbiscan.io/address/0x9d82033BB36217B44567edC635bE926f74D1b76f) - - any protections? YES: the new rate is based on a `_newUsr` value being pushed to the `usrConfigs` array, which is being read during the rate computation. The values are pushed as part of the permission call to `_addNewUsrConfig`. Various checks are in place to ensure resulting rates are bound to certain increasing/decreasing threshold levels. This includes: + - any protections? YES: the new rate is based on a `_newUsr` value being pushed to the `usrConfigs` array, which is being read during the rate computation. The values are pushed as part of the permissioned call to `_addNewUsrConfig`. Various checks are in place to ensure resulting rates are bound to certain increasing/decreasing threshold levels. This includes: - New epoch start times needing to be equal to or greater then the current block.timestamp - new epoch start time needing to be greater or equal than the last epoch end time - and `newUsr >= MIN_USR && _newUsr <= MAX_USR` as a requirement. @@ -61,6 +61,6 @@ If none of these is checked, then this might be a pretty great Rate Provider! If To save time, we do not bother pointing out low-severity/informational issues or gas optimizations (unless the gas usage is particularly egregious). Instead, we focus only on high- and medium-severity findings which materially impact the contract's functionality and could harm users. ## Conclusion -**Summary judgment: USABLE/** +**Summary judgment: USABLE** These rate providers are usable with Balancer pools. The system upgradeability is behind a 3/5 multisig and oracle state updates are permissioned (3/5 multisig) as well as validity checks are done on the data being pushed by the oracle. From a234e296dd7ed514605ff161714f8ea33ba3275b Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 31 Jul 2024 16:25:05 +0200 Subject: [PATCH 3/3] Add checked by --- rate-providers/sUSXRateProvider.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rate-providers/sUSXRateProvider.md b/rate-providers/sUSXRateProvider.md index 455b27e..0e2d0ee 100644 --- a/rate-providers/sUSXRateProvider.md +++ b/rate-providers/sUSXRateProvider.md @@ -2,7 +2,7 @@ ## Details - Reviewed by: @mkflow27 -- Checked by: @\ +- Checked by: @danielmkm - Deployed at: - [ethereum:0xc497F11326c3DE5086710EDa43354697b32c1541](https://etherscan.io/address/0xc497F11326c3DE5086710EDa43354697b32c1541) - [arbitrum:0xf7ec24690fBCEc489E7C9A7055C04Db5C221c397](https://arbiscan.io/address/0xf7ec24690fBCEc489E7C9A7055C04Db5C221c397)