Skip to content

Commit

Permalink
Merge branch 'main' into Aave-Mainnet-BasicERC4626RateProviders
Browse files Browse the repository at this point in the history
  • Loading branch information
mkflow27 committed Dec 9, 2024
2 parents fba7c0e + 0955ff3 commit 68bb59d
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hooks/DirectionalFeeHook.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- Reviewed by: @mkflow27
- Checked by: @danielmkm
- Deployed at:
- [sepolia:0xcdF93FaB48405bb9df9c321b6306e701be6F9859](https://sepolia.etherscan.io/address/0xcdF93FaB48405bb9df9c321b6306e701be6F9859)
- [sepolia:0xD9e535a65eb38F962B84f7BBD2bf60293bA54058](https://sepolia.etherscan.io/address/0xcdF93FaB48405bb9df9c321b6306e701be6F9859)
- Audit report(s):
-

Expand Down
2 changes: 1 addition & 1 deletion hooks/ExitFeeHook.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- Reviewed by: @mkflow27
- Checked by: @danielmkm
- Deployed at:
- [sepolia:0x307d96183f133c738Af11D1971BF0A5ee15312be](https://sepolia.etherscan.io/address/0x307d96183f133c738Af11D1971BF0A5ee15312be)
- [sepolia:0x2Aa9D4066DAe16ef001765efF2cA8F41Bde0b019](https://sepolia.etherscan.io/address/0x307d96183f133c738Af11D1971BF0A5ee15312be)
- Audit report(s):
-

Expand Down
2 changes: 1 addition & 1 deletion hooks/FeeTakingHook.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- Reviewed by: @mkflow27
- Checked by: @danielmkm
- Deployed at:
- [sepolia:0x5c7FB0734d327ECeE2cA5cF2F5fE0f5Ff32dbf0b](https://sepolia.etherscan.io/address/0x5c7FB0734d327ECeE2cA5cF2F5fE0f5Ff32dbf0b)
- [sepolia:0x790ae803b6c0467C6A4cbDc6d6d712DE34CfdB76](https://sepolia.etherscan.io/address/0x5c7FB0734d327ECeE2cA5cF2F5fE0f5Ff32dbf0b)
- Audit report(s):
-

Expand Down
2 changes: 1 addition & 1 deletion hooks/LotteryHook.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- Reviewed by: @mkflow27
- Checked by: @danielmkm
- Deployed at:
- [sepolia:0xb4b339a93B7E3D9B8266d52C96608F0615326B98](https://sepolia.etherscan.io/address/0xb4b339a93B7E3D9B8266d52C96608F0615326B98)
- [sepolia:0x0E85194F9eD75F0EFf2b89B73b6AD3053be03853](https://sepolia.etherscan.io/address/0xb4b339a93B7E3D9B8266d52C96608F0615326B98)
- Audit report(s):
-

Expand Down
8 changes: 4 additions & 4 deletions hooks/registry.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"sepolia":{
"0x5c7FB0734d327ECeE2cA5cF2F5fE0f5Ff32dbf0b":{
"0x790ae803b6c0467C6A4cbDc6d6d712DE34CfdB76":{
"name": "FeeTakingHookExample",
"summary": "safe",
"review": "./FeeTakingHook.md",
"warnings": []
},
"0x307d96183f133c738Af11D1971BF0A5ee15312be":{
"0x2Aa9D4066DAe16ef001765efF2cA8F41Bde0b019":{
"name": "ExitFeeHookExample",
"summary": "safe",
"review": "./ExitFeeHook.md",
"warnings": []
},
"0xcdF93FaB48405bb9df9c321b6306e701be6F9859":{
"0xD9e535a65eb38F962B84f7BBD2bf60293bA54058":{
"name": "DirectionalFeeHookExample",
"summary": "safe",
"review": "./DirectionalFeeHook.md",
"warnings": []
},
"0xb4b339a93B7E3D9B8266d52C96608F0615326B98":{
"0x0E85194F9eD75F0EFf2b89B73b6AD3053be03853":{
"name": "LotteryHookExample",
"summary": "safe",
"review": "./LotteryHook.md",
Expand Down
48 changes: 48 additions & 0 deletions rate-providers/BlraSdaiRateProvider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Rate Provider: `BlraSdaiRateProvider`

## Details
- Reviewed by: @mkflow27
- Checked by: @danielmkm
- Deployed at:
- [gnosis:0xCCfE43E5853C87225948317379ffD910039f6A14](https://gnosisscan.io/address/0xCCfE43E5853C87225948317379ffD910039f6A14#code)
- Audit report(s):
- [No audits provided]

## Context
This rate provider fetches the BRLA (brasilian real) / USD exchange rate from a Chronicle Labs Oracle. It then divides by the `sDaiDaiRate` to calculate the `blraSdaiRate`.

## 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).

- [ ] 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).

### Oracles
- [x] Price data is provided by an off-chain source (e.g., a Chainlink oracle, a multisig, or a network of nodes).
- source: Chronicle Labs
- source address: [ethereum:0xEB2F9EF61A2174A4066CB36E265Ea6D5Dd0ADCFe](https://gnosisscan.io/address/0xEB2F9EF61A2174A4066CB36E265Ea6D5Dd0ADCFe#code)
- any protections? YES
The oracle is based on a previous review. For more information see the [review]("./TollgateChronicleRateProvider.md").

- [x] Price data is expected to be volatile (e.g., because it represents an open market price instead of a (mostly) monotonically increasing price). The rate is based on an open market exchange rate of BRL/USD.

### Common Manipulation Vectors
- [x] The Rate Provider is susceptible to donation attacks. For details see the [review]("./SavingsDAIRateProviderGnosis.md").

## 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**

This rate provider is a combination of previously investigated rate providers, which were deemed usable. This investigated rate provider should work well with Balancer pools.
94 changes: 94 additions & 0 deletions rate-providers/HighGrowthEthRateProvider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Rate Provider: `ERC4626RateProvider`

## Details
- Reviewed by: @mkflow27
- Checked by: @danielmkm
- Deployed at:
- [ethereum:0xf47c506C293319B3bC517Acc371F86B87B03DD5D](https://etherscan.io/address/0xf47c506C293319B3bC517Acc371F86B87B03DD5D#code)
- Audit report(s):
- [hgETH audit](https://kelpdao.xyz/audits/smartcontracts/Sigma_Prime_hgETH.pdf)

## Context
The rate provider reports the rate of hgETH relative to rsETH. This includes an totalAssets / totalSupply approach, where totalAssets are calculated as a combination of a `globalLoansAmount` + assets held in the vault + reserved amount of rsETH as part of the `gainAdapter`.

## 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).

#### hgETH
- upgradeable component: `GainLendingPool` ([ethereum:0xc824A08dB624942c5E5F330d56530cD1598859fD](https://etherscan.io/address/0xc824A08dB624942c5E5F330d56530cD1598859fD#readProxyContract))
- admin address: [ethereum:0xFD96F6854bc73aeBc6dc6E61A372926186010a91](https://etherscan.io/address/0xFD96F6854bc73aeBc6dc6E61A372926186010a91#code)
- admin type: multisig
- multisig threshold/signers: 3/5

#### GainAdapterETH
- upgradeable component: `GainAdapterETH` ([ethereum:0xB185D98056419029daE7120EcBeFa0DbC12c283A](https://etherscan.io/address/0xB185D98056419029daE7120EcBeFa0DbC12c283A))
- admin address: [ethereum:0xb9577E83a6d9A6DE35047aa066E3758221FE0DA2](https://etherscan.io/address/0xb9577E83a6d9A6DE35047aa066E3758221FE0DA2)
- admin type: multisig
- multisig threshold/signers: 3/5

#### EthXPriceOracle
- upgradeable component: `EthXPriceOracle` ([ethereum:0x3D08ccb47ccCde84755924ED6B0642F9aB30dFd2](https://etherscan.io/address/0x3D08ccb47ccCde84755924ED6B0642F9aB30dFd2#readProxyContract))
- admin address: [ethereum:0xb3696a817D01C8623E66D156B6798291fa10a46d](https://etherscan.io/address/0xb3696a817D01C8623E66D156B6798291fa10a46d#code)
- admin type: multisig
- multisig threshold/signers: 6/8
- multisig timelock? 10 day


### Oracles
- [ ] Price data is provided by an off-chain source (e.g., a Chainlink oracle, a multisig, or a network of nodes).

- [ ] 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
- [x] The Rate Provider is susceptible to donation attacks.
Part of the rate calculation depends on the following implementation snippet.
```solidity
function _getTotalAssets() internal view virtual override returns (uint256) {
// [Liquidity] + [the delta of all ACTIVE loans managed by this pool]
return globalLoansAmount + _underlyingAsset.balanceOf(address(this));
}
````
Where the Vault's `asset`'s balance is used.
## 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.
### M-01: Unverified contracts potentially allowed to influence the rate.
The rate can be changed by unverified contracts. The state variable `globalLoansAmount` (which is a factor of the rate calculation) can be
changed by authorized (currently unverified contracts) calling `notifyPrincipalRepayment`.
```solidity
function notifyPrincipalRepayment(
uint256 effectiveLoanAmount,
uint256 principalRepaid
) external override nonReentrant ifConfigured onlyKnownLoanContract {
uint256 newDelta = (principalRepaid < effectiveLoanAmount) ? effectiveLoanAmount - principalRepaid : 0;
if (_deployedLoans[msg.sender].activeDelta > 0) globalLoansAmount -= _deployedLoans[msg.sender].activeDelta;
_deployedLoans[msg.sender].activeDelta = newDelta;
if (newDelta > 0) globalLoansAmount += newDelta;
}
```

The amount of loanContracts potentially being allowed to call this functions are accessible via `getTotalLoansDeployed` and then iterating through the indexes via `loansDeployed`. The current `globalLoansAmount` is `1253053000000000000000`.

## Conclusion
**Summary judgment: USABLE**

This rate provider should work will Balancer pools. Users should however take into account that there are currently unverified contracts potentially influencing the rate calculation as outlined above. Besides that upgradeability is guarded behind multisigs.
45 changes: 45 additions & 0 deletions rate-providers/StatATokenTestnetRateProvider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Rate Provider: `ERC4626RateProvider`

## Details
- Reviewed by: @mattpereira
- Checked by: @mkflow27
- Deployed at:
- [sepolia:0xB1B171A07463654cc1fE3df4eC05f754E41f0A65](https://sepolia.etherscan.io/address/0xB1B171A07463654cc1fE3df4eC05f754E41f0A65)
- [sepolia:0x22db61f3a8d81d3d427a157fdae8c7eb5b5fd373](https://sepolia.etherscan.io/address/0x22db61f3a8d81d3d427a157fdae8c7eb5b5fd373)
- [sepolia:0x34101091673238545De8a846621823D9993c3085](https://sepolia.etherscan.io/address/0x34101091673238545De8a846621823D9993c3085)
- Audit report(s):
- [Scaffold Audits](https://github.com/balancer/scaffold-balancer-v3)

## Context
Testnet rate providers for the static AAVE tokens balancer is using to test boosted pools feature of v3 contracts

## 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. @mendesfabio deployed these contracts

- [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).
- [ ] 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).

### Oracles
- [ ] Price data is provided by an off-chain source (e.g., a Chainlink oracle, a multisig, or a network of nodes).
- [ ] 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: SAFE**

These are only testnet rate providers with a spoof audit report link to allow for pool creation UI development that is reliant on `priceRateProviderData` returned by the `tokenGetTokens` query of the Balancer API
61 changes: 60 additions & 1 deletion rate-providers/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -1757,6 +1757,28 @@
"factory": "0x467665D4ae90e7A99c9C9AF785791058426d6eA0",
"upgradeableComponents": []
},
"0xf47c506C293319B3bC517Acc371F86B87B03DD5D": {
"asset": "0xc824A08dB624942c5E5F330d56530cD1598859fD",
"name": "ERC4626RateProvider",
"summary": "safe",
"review": "./HighGrowthEthRateProvider.md",
"warnings": ["donation", "unverified-contracts"],
"factory": "0xFC541f8d8c5e907E236C8931F0Df9F58e0C259Ec",
"upgradeableComponents": [
{
"entrypoint": "0xB185D98056419029daE7120EcBeFa0DbC12c283A",
"implementationReviewed": "0x3151293F241bd7391f4ecAeF206607b59f424417"
},
{
"entrypoint": "0xc824A08dB624942c5E5F330d56530cD1598859fD",
"implementationReviewed": "0xed5c8c80a29e541b8781e0e729d9af597a368589"
},
{
"entrypoint": "0x3D08ccb47ccCde84755924ED6B0642F9aB30dFd2",
"implementationReviewed": "0x3f258821a5ad28391e9Bb0B69A705fdf545BCab0"
}
]
},
"0xc81D60E39e065146c6dE186fFC5B39e4CA2189Cf": {
"asset": "0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB",
"name": "ERC4626RateProvider",
Expand Down Expand Up @@ -1974,7 +1996,6 @@
"factory": "",
"upgradeableComponents": []
},

"0x5F62fd24941B585b91EB059E0ea1a7e729357511": {
"asset": "0xf0E7eC247b918311afa054E0AEdb99d74c31b809",
"name": "ERC4626RateProvider",
Expand All @@ -1984,6 +2005,15 @@
"factory": "0x15e86be6084c6a5a8c17732d398dfbc2ec574cec",
"upgradeableComponents": []
},
"0xCCfE43E5853C87225948317379ffD910039f6A14": {
"asset": "0xFECB3F7c54E2CAAE9dC6Ac9060A822D47E053760",
"name": "BlraSdaiRateProvider",
"summary": "safe",
"review": "./BlraSdaiRateProvider.md",
"warnings": ["donation"],
"factory": "",
"upgradeableComponents": []
},
"0x0008A59C1d2E5922790C929ea432ed02D4D3323A": {
"asset": "0x57f664882F762FA37903FC864e2B633D384B411A",
"name": "ERC4626RateProvider",
Expand Down Expand Up @@ -2512,5 +2542,34 @@
"factory": "0x4132f7AcC9dB7A6cF7BE2Dd3A9DC8b30C7E6E6c8",
"upgradeableComponents": []
}
},
"sepolia": {
"0xB1B171A07463654cc1fE3df4eC05f754E41f0A65": {
"asset": "0x978206fAe13faF5a8d293FB614326B237684B750",
"name": "waUSDT Rate Provider",
"summary": "safe",
"review": "./StatATokenTestnetRateProvider.md",
"warnings": [],
"factory": "",
"upgradeableComponents": []
},
"0x22db61f3a8d81d3d427a157fdae8c7eb5b5fd373": {
"asset": "0xDE46e43F46ff74A23a65EBb0580cbe3dFE684a17",
"name": "waDAI Rate Provider",
"summary": "safe",
"review": "./StatATokenTestnetRateProvider.md",
"warnings": [],
"factory": "",
"upgradeableComponents": []
},
"0x34101091673238545De8a846621823D9993c3085": {
"asset": "0x8A88124522dbBF1E56352ba3DE1d9F78C143751e",
"name": "waUSDC Rate Provider",
"summary": "safe",
"review": "./StatATokenTestnetRateProvider.md",
"warnings": [],
"factory": "",
"upgradeableComponents": []
}
}
}

0 comments on commit 68bb59d

Please sign in to comment.