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

Superform USDC rate providers and vaults on Mainnet and Base #257

Merged
merged 9 commits into from
Feb 5, 2025
40 changes: 40 additions & 0 deletions erc4626/SuperformSuperVaultReview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ERC4626 Vault: `SuperVault`

## Details
- Reviewed by: @mattpereira
- Checked by: @mkflow27
- Deployed at:
- [ethereum:0xF7DE3c70F2db39a188A81052d2f3C8e3e217822a](https://etherscan.io/address/0xF7DE3c70F2db39a188A81052d2f3C8e3e217822a#code)
- [base:0xe9F2a5F9f3c846f29066d7fB3564F8E6B6b2D65b](https://basescan.org/address/0xe9F2a5F9f3c846f29066d7fB3564F8E6B6b2D65b#code)
- Audit report(s):
- [SuperVaults Audits](https://github.com/superform-xyz/SuperVaults/tree/main/audits)

## Context
A SuperVault manages multiple Superforms (Superform positions linked to vaults) and incorporates mechanisms for rebalancing, whitelisting, and deposit limits. SuperVault contracts delegate most of their core ERC-4626 vault functionality to the Yearn V3 TokenizedStrategy contract.

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

- [ ] Tests based on the [balancer-v3-monorepo](https://github.com/balancer/balancer-v3-monorepo/tree/main/pkg/vault/test/foundry/fork) pass for the given ERC4626 vaults, which can be found [here](https://github.com/balancer/balancer-v3-erc4626-tests/tree/main/test).
- [x] The required Vault implements the required operational ERC4626 Interface

## 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 ERC4626 Vault is upgradeable (e.g., via a proxy architecture or an `onlyOwner` function that updates the price source address).

### Buffer blocklist
- [x] The reviewed ERC4626 Vault should be added to the blocked buffers metadata list.

### Common Manipulation Vectors
- [ ] The ERC4626 Vault 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**
The outlined ERC4626 Vaults should work with Balancer pools, but are not compatible with buffers since `testWithdraw` reverts with "too much loss", perhaps because SuperVaults leverage Yearn v3 `TokenizedStrategy` contract, which requires profits to be gradually unlocked over time, making it difficult to guarantee immediate withdrawals at the expected share price. Fork tests can be seen [here](https://github.com/balancer/balancer-v3-erc4626-tests/pull/24)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without knowing the contract in details I suspect that gradual unlocks of profits should not lead to "losses" accrueing. At most the same amounts should be withdrawn, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My interpretation of the failling test was that it attempts to withdraw based on an expected amount the test calculates, but that amount ends up being too low because the SuperVault contract will only release funds that have been unlocked, and not the full amount including profits until the over time part elapses

16 changes: 16 additions & 0 deletions erc4626/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@
}
},
"base": {
"0xe9F2a5F9f3c846f29066d7fB3564F8E6B6b2D65b": {
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"name": "Superform USDC",
"summary": "safe",
"review": "./SuperformSuperVaultReview.md",
"warnings": ["buffer"],
"isCompatible": "false"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failing fork tests are an indication that this Vault is not comppatible

},
"0x616a4E1db48e22028f6bbf20444Cd3b8e3273738": {
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"name": "MetaMorpho v1.1 Seamless USDC",
Expand Down Expand Up @@ -196,6 +204,14 @@
}
},
"ethereum": {
"0xF7DE3c70F2db39a188A81052d2f3C8e3e217822a": {
"asset": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"name": "Superform USDC",
"summary": "safe",
"review": "./SuperformSuperVaultReview.md",
"warnings": ["buffer"],
"isCompatible": "false"
},
"0x2371e134e3455e0593363cBF89d3b6cf53740618": {
"asset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"name": "MetaMorpho Gauntlet wETH Prime",
Expand Down
58 changes: 58 additions & 0 deletions rate-providers/SuperformRateProviders.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Rate Provider: `ERC4626RateProvider`

## Details
- Reviewed by: @mattpereira
- Checked by: @mkflow27
- Deployed at:
- [ethereum:0x9fA39387D479fd456367190c82739eD6dC86491D](https://etherscan.io/address/0x9fA39387D479fd456367190c82739eD6dC86491D#code)
- [base:0x829Be222f36C6B7D48a7e1270b3c070BA2Ee98C4](https://basescan.org/address/0x829Be222f36C6B7D48a7e1270b3c070BA2Ee98C4#code)
- Audit report(s):
- [yAudit Superform Router Plus and Super Vaults Review](https://github.com/superform-xyz/SuperVaults/blob/main/audits/yAudit_report.pdf)

## Context
The ERC4626 RateProvider fetches the rate of SuperVault tokens in terms of the underlying asset. The exchange rate is provided via the conversion between totalAssets and totalSupply. Each SuperVault manages multiple "Superforms", which are positions linked to other vaults. A `SuperVaultManager` role controls a whitelist of vaults where funds can be allocated. A `SuperVaultStrategist` role is allowed to rebalance the allocation of assets amongst whitelisted vaults.

## 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).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this information.

Part of the rate computation relies on how `totalAssets` is calculated, and `totalAssets` can be changed by the `SuperVaultStrategist` calling `rebalance` to shift assets into any of the whitelisted vaults. The whitelist is controlled by the `SuperVaultManager`. The SuperVault validates data accuracy during `rebalance` operations by performing:
- Duplicate checks
- Whitelist checks
- Is superform from factory check
- Superform existence check

#### [ethereum:0x9fA39387D479fd456367190c82739eD6dC86491D](https://etherscan.io/address/0x9fA39387D479fd456367190c82739eD6dC86491D#code)
The relevant [vault](https://etherscan.io/address/0xF7DE3c70F2db39a188A81052d2f3C8e3e217822a#readContract) roles are both EoAs
- `SuperVaultManager` : [0x701aE9c540ba2144b669F22e650882e7e07cB11F](https://etherscan.io/address/0x701aE9c540ba2144b669F22e650882e7e07cB11F)
- `SuperVaultStrategist` : [0xFa476C5ec7A43a68e081fD5a33f668f0BD09e126](https://etherscan.io/address/0xFa476C5ec7A43a68e081fD5a33f668f0BD09e126)

#### [base:0x829Be222f36C6B7D48a7e1270b3c070BA2Ee98C4](https://basescan.org/address/0x829Be222f36C6B7D48a7e1270b3c070BA2Ee98C4#code)
The relevant vault roles are both EoAs
- `SuperVaultManager` : [0x701aE9c540ba2144b669F22e650882e7e07cB11F](https://basescan.org/address/0x701aE9c540ba2144b669F22e650882e7e07cB11F)
- `SuperVaultStrategist` : [0xFa476C5ec7A43a68e081fD5a33f668f0BD09e126](https://basescan.org/address/0xFa476C5ec7A43a68e081fD5a33f668f0BD09e126)

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


## Conclusion
**Summary judgment: USABLE**

The Rate Providers should work as expected with Balancer pools. No portion of the price pipeline is upgradeable, and common manipulation vectors are mitigated by SuperVaults deleagating most of their core ERC-4626 vault functionality to the Yearn V3 TokenizedStrategy contract.
18 changes: 18 additions & 0 deletions rate-providers/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,15 @@
}
},
"base": {
"0x829Be222f36C6B7D48a7e1270b3c070BA2Ee98C4": {
"asset": "0xe9F2a5F9f3c846f29066d7fB3564F8E6B6b2D65b",
"name": "Superform USDC Rate Provider",
"summary": "safe",
"review": "./SuperformRateProviders.md",
"warnings": [],
"factory": "0xEfD3aF73d3359014f3B864d37AC672A6d3D7ff1A",
"upgradeableComponents": []
},
"0xe1b1e024f4Bc01Bdde23e891E081b76a1A914ddd": {
"asset": "0xd95ca61CE9aAF2143E81Ef5462C0c2325172E028",
"name": "WrappedUsdPlusRateProvider",
Expand Down Expand Up @@ -923,6 +932,15 @@
}
},
"ethereum": {
"0x9fA39387D479fd456367190c82739eD6dC86491D": {
"asset": "0xF7DE3c70F2db39a188A81052d2f3C8e3e217822a",
"name": "Superform USDC Rate Provider",
"summary": "safe",
"review": "./SuperformRateProviders.md",
"warnings": [],
"factory": "0xFC541f8d8c5e907E236C8931F0Df9F58e0C259Ec",
"upgradeableComponents": []
},
"0x1aCB59d7c5D23C0310451bcd7bA5AE46d18c108C": {
"asset": "0xF1617882A71467534D14EEe865922de1395c9E89",
"name": "asETHRateProvider",
Expand Down