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

Mkflow27/issue107 #125

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions rate-providers/SolvBTCRateProvider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Rate Provider: `SolvBTCYieldTokenBalancerRateProvider`

## Details
- Reviewed by: @mkflow27
- Checked by: @\<GitHub handle of secondary reviewer\>
- Deployed at:
- [ethereum:0x99A77a36C9066b1e37cA87E9328eFB87FcFF7E2b](https://etherscan.io/address/0x99A77a36C9066b1e37cA87E9328eFB87FcFF7E2b#code)
- [arbitrum:0xeA70471806667232f176eD5EeCCc7D606A3d2C39](https://arbiscan.io/address/0xeA70471806667232f176eD5EeCCc7D606A3d2C39#code)
- Audit report(s):
- [SolvBTC audits](https://github.com/solv-finance/Audit)

## Context
SolvBTC.BBN is a liquid staking token (LST) for Bitcoin, representing the staked Bitcoin in Babylon. SolvBTC.BBN allows Bitcoin holders to earn staking yields it can be obtained by staking SolvBTC. SolvBTC.BBN will not produce yields initially but is designed in preparation for Babylon’s mainnet launch. When Babylon launches its mainnet, Solv will be among the first participants, positioning SolvBTC.bbn as a pioneering liquid staking token for Bitcoin.

## 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).
#### Mainnet SolvBTCYieldTokenBalancerRateProvider
- upgradeable component: `SftWrappedToken` ([ethereum:0xd9D920AA40f578ab794426F5C90F6C731D159DEf](https://etherscan.io/address/0xd9D920AA40f578ab794426F5C90F6C731D159DEf#readProxyContract))
- admin address: [ethereum:0x55C09707Fd7aFD670e82A62FaeE312903940013E](https://etherscan.io/address/0x55C09707Fd7aFD670e82A62FaeE312903940013E)
- admin type: EOA

- upgradeable component: `NavOracle` ([ethereum:0x8c29858319614380024093DBEE553F9337665756](https://etherscan.io/address/0x8c29858319614380024093DBEE553F9337665756#code))
- admin address: [ethereum:0x55C09707Fd7aFD670e82A62FaeE312903940013E](https://etherscan.io/address/0x55C09707Fd7aFD670e82A62FaeE312903940013E)
- admin type: EOA

- upgradeable component: `AddressResolver` ([ethereum:0xc2f69541e3dC306777D260dC66bfD54fcb897100](https://etherscan.io/address/0xc2f69541e3dC306777D260dC66bfD54fcb897100#readProxyContract))
- admin address: [ethereum:0x55C09707Fd7aFD670e82A62FaeE312903940013E](https://etherscan.io/address/0x55C09707Fd7aFD670e82A62FaeE312903940013E)
- admin type: EOA
- comment: the `owner` role of this contract is [ethereum:0x55C09707Fd7aFD670e82A62FaeE312903940013E](https://etherscan.io/address/0x55C09707Fd7aFD670e82A62FaeE312903940013E) and it is allowed of changing the oracle address, which is allowed to call `setSubscribeNavOnlyMarket` on the `NavOracle` contract.

- upgradeable component: `OpenFundMarket` ([ethereum:0x57bB6a8563a8e8478391C79F3F433C6BA077c567](https://etherscan.io/address/0x57bb6a8563a8e8478391c79f3f433c6ba077c567#readProxyContract))
- admin address: [ethereum:0x55C09707Fd7aFD670e82A62FaeE312903940013E](https://etherscan.io/address/0x55C09707Fd7aFD670e82A62FaeE312903940013E)
- admin type: EOA

#### Arbitrum SolvBTCYieldTokenBalancerRateProvider

- upgradeable component: `SftWrappedToken` ([arbitrum:0x346c574C56e1A4aAa8dc88Cda8F7EB12b39947aB](https://arbiscan.io/address/0x346c574C56e1A4aAa8dc88Cda8F7EB12b39947aB#readProxyContract))
- admin address: [arbitrum:0x55C09707Fd7aFD670e82A62FaeE312903940013E](https://arbiscan.io/address/0x55C09707Fd7aFD670e82A62FaeE312903940013E)
- admin type: EOA

- upgradeable component: `NavOracle` ([arbitrum:0x6ec1fEC6c6AF53624733F671B490B8250Ff251eD](https://arbiscan.io/address/0x6ec1fEC6c6AF53624733F671B490B8250Ff251eD#readProxyContract))
- admin address: [arbitrum:0x9523d4054FDbBb9F65121f3A89faC0C8b258c9CB](https://arbiscan.io/address/0x9523d4054FDbBb9F65121f3A89faC0C8b258c9CB)
- admin type: EOA

- upgradeable component: `AddressResolver` ([:]())
- admin address: [arbitrum:0x55C09707Fd7aFD670e82A62FaeE312903940013E](https://arbiscan.io/address/0x55C09707Fd7aFD670e82A62FaeE312903940013E)
- admin type: EOA
- comment: the `owner` role of this contract is [arbitrum:0x55C09707Fd7aFD670e82A62FaeE312903940013E](https://arbiscan.io/address/0x55C09707Fd7aFD670e82A62FaeE312903940013E) and it is allowed of changing the oracle address, which is allowed to call `setSubscribeNavOnlyMarket` on the `NavOracle` contract.

- upgradeable component: `OpenFundMarket` ([arbitrum:0x629aD7Bc14726e9cEA4FCb3A7b363D237bB5dBE8](https://arbiscan.io/address/0x629aD7Bc14726e9cEA4FCb3A7b363D237bB5dBE8#readProxyContract))
- admin address: [arbitrum:0x55C09707Fd7aFD670e82A62FaeE312903940013E](https://arbiscan.io/address/0x55C09707Fd7aFD670e82A62FaeE312903940013E)
- admin type: EOA

### Oracles
- [x] Price data is provided by an off-chain source (e.g., a Chainlink oracle, a multisig, or a network of nodes).
- source: Custom oracle called "OpenFundMarket".
- source address:
#### Mainnet
[ethereum:0x57bb6a8563a8e8478391c79f3f433c6ba077c567](https://etherscan.io/address/0x57bb6a8563a8e8478391c79f3f433c6ba077c567#readProxyContract)
#### Arbitrum
[arbitrum:0x629aD7Bc14726e9cEA4FCb3A7b363D237bB5dBE8](https://arbiscan.io/address/0x629aD7Bc14726e9cEA4FCb3A7b363D237bB5dBE8#readProxyContract)
- any protections? YES: The nav is updated as part of the `setSubscribeNav` function on the `OpenFundMarket`. There is an access check which requires the sender to be `poolInfo.managerInfo.subscribeNavManager`.
```solidity
function setSubscribeNav(bytes32 poolId_, uint256 time_, uint256 nav_) external virtual override {
PoolInfo storage poolInfo = poolInfos[poolId_];
require(poolInfo.poolSFTInfo.openFundShareSlot != 0, "OFM: pool does not exist");
require(_msgSender() == poolInfo.managerInfo.subscribeNavManager, "OFM: only subscribe nav manager");
INavOracle(poolInfo.navOracle).setSubscribeNavOnlyMarket(poolId_, time_, nav_);
emit SetSubscribeNav(poolId_, time_, nav_);
}
```
- comment: See comment on the `owner` role of the `AddressResolver` resolver top wrt. protections.

- [ ] 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/UNSAFE\>**

This contract should work with Balancer pools. However since this was a timeboxed review, the checks for downstream oracle (OpenFundMarket) data providers have not been done. Various contracts are upgradeable by EOAs which pose a risk for potentially drastic rate changes and further clarification is required.
52 changes: 52 additions & 0 deletions rate-providers/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,32 @@
"implementationReviewed": "0x339B34965bD3A61025eEA3D5FDcADf75756cc0Db"
}
]
},
"0xeA70471806667232f176eD5EeCCc7D606A3d2C39": {
"asset": "",
"name": "SolvBTCYieldTokenBalancerRateProvider",
"summary": "",
"review": "./SolvBTCRateProvider.md",
"warnings": [],
"factory": "",
"upgradeableComponents": [
{
"entrypoint": "0x346c574C56e1A4aAa8dc88Cda8F7EB12b39947aB",
"implementationReviewed": "0xa6F5cf9259E4ba72b195b5F3caBe2577ce205dF2"
},
{
"entrypoint": "0x6ec1fEC6c6AF53624733F671B490B8250Ff251eD",
"implementationReviewed": "0x8c29858319614380024093DBEE553F9337665756"
},
{
"entrypoint": "0xc2f69541e3dC306777D260dC66bfD54fcb897100",
"implementationReviewed": "0xE0331CcF831703d30C0EeA134444104e94246B15"
},
{
"entrypoint": "0x629aD7Bc14726e9cEA4FCb3A7b363D237bB5dBE8",
"implementationReviewed": "0x976fA12d7f3381B4d94181A10bE2ED206B72e6B3"
}
]
}
},
"avalanche": {
Expand Down Expand Up @@ -1305,6 +1331,32 @@
"implementationReviewed": "0xd295936C8Bb465ADd1eC756a51698127CB4F4910"
}
]
},
"0x99A77a36C9066b1e37cA87E9328eFB87FcFF7E2b": {
"asset": "",
"name": "SolvBTCYieldTokenBalancerRateProvider",
"summary": "",
"review": "./SolvBTCRateProvider.md",
"warnings": [],
"factory": "",
"upgradeableComponents": [
{
"entrypoint": "0xd9D920AA40f578ab794426F5C90F6C731D159DEf",
"implementationReviewed": "0xb2B9DE3D047183d36769CDeb8dA3882c88AF75D9"
},
{
"entrypoint": "0x8c29858319614380024093DBEE553F9337665756",
"implementationReviewed": "0x491199168de68d4dcFBa072F06b5ea0Fadc21c70"
},
{
"entrypoint": "0x57bB6a8563a8e8478391C79F3F433C6BA077c567",
"implementationReviewed": "0x1a7D5f3497F722843597C344F0d5bd08Fb043e1f"
},
{
"entrypoint": "0xc2f69541e3dC306777D260dC66bfD54fcb897100",
"implementationReviewed": "0xE0331CcF831703d30C0EeA134444104e94246B15"
}
]
}
},
"gnosis": {
Expand Down
Loading