Conversation
This commit restores full API3 oracle functionality that was previously removed,
enabling proper oracle configuration for frxUSD and sfrxUSD assets on mainnet.
Changes:
- Restored 15 API3 oracle files from sonic-solidity-contracts
- Core wrapper contracts (API3Wrapper, API3WrapperWithThresholding, etc.)
- Interface contracts and mock implementations for testing
- Test files for API3 oracle functionality
- Deployment scripts for ETH and USD ecosystems
- Updated configuration files to support API3 oracles
- Added API3 oracle asset interfaces to config/types.ts
- Configured frxUSD/USD and sfrxUSD/frxUSD to use API3 oracles
- Set correct mainnet addresses for frxUSD and sfrxUSD tokens
- Added proper API3 proxy addresses for mainnet feeds
- Updated deployment and test infrastructure
- Added API3 mock oracle deployment for local testing
- Extended test fixtures to support API3 oracle testing
- Fixed deployment scripts to use correct ETH/USD constants
- Added API3 constants and deploy IDs
- Updated oracle price display and deployment scripts
Mainnet Configuration:
- frxUSD: 0xFB55A212Dd6187bc4B088a79F7ab9d1aeA86E50e
- API3 feed: 0x4Dc7AAd0DfA29565469172dcaAc33cEd6FFF56B6 (frxUSD/USD)
- sfrxUSD: 0xBA2F8EA0A9e790ffC982F7241bEc17af949C71b3
- API3 feeds: 0x0F546720261f447A8810A466269BCE6A66Cd1326 (sfrxUSD/frxUSD)
0x4Dc7AAd0DfA29565469172dcaAc33cEd6FFF56B6 (frxUSD/USD)
All tests passing, deployment successful, and linting clean.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
|
Deployed MorphoOracleWrappers for yvvbUSDT/USDC and yvvbUSDC/USDT |
Git-on-my-level
left a comment
There was a problem hiding this comment.
There are some significant safety concerns that should be addressed before usage
| }, | ||
| chainlinkCompositeAggregator: {}, | ||
| oracleWrapperAggregators: { | ||
| USDT: { |
There was a problem hiding this comment.
This is inconsistent with other oracle configs
The key should be the asset for which we are returning the USD price for. However in this case, this isn't for USDT/USD, but rather this is supposed to be for yvvbUSDC/USD
| function getPriceInfo(address asset) public view override returns (uint256 price, bool isAlive) { | ||
| // Get price info from both wrappers | ||
| (uint256 basePrice, bool baseAlive) = BASE_WRAPPER.getPriceInfo(asset); | ||
| (uint256 quotePrice, bool quoteAlive) = QUOTE_WRAPPER.getPriceInfo(asset); |
There was a problem hiding this comment.
This logic seems incorrect for the general case
- Let's say we have 2 feeds we want to compose. Let's say the BASE_WRAPPER provides ETH/USDT and QUOTE_WRAPPER provides USDT/USD
- Let's say the goal is to get a ETH/USD feed. We pass in getPriceInfo(ETH)
- This calls BASE_WRAPPER.getPriceInfo(ETH) which returns the ETH/USDT feed -> good
- QUOTE_WRAPPER.getPriceInfo(ETH) is undefined, it only supports getPriceInfo(USDT) in this case -> bad
The correct asset to pass into QUOTE_WRAPPER is BASE_WRAPPER.baseCurrency
| mapping(address => VaultConfig) public vaultConfigs; | ||
|
|
||
| /// @notice Maximum allowed price deviation in basis points (5% default) | ||
| uint256 public maxDeviation = 500; |
There was a problem hiding this comment.
We should standardize all contracts to use contracts/common/BasisPointConstants.sol
| uint256 currentPrice = IERC4626(vault).convertToAssets(_baseCurrencyUnit); | ||
|
|
||
| // Apply bounds checking for manipulation resistance | ||
| if (config.lastValidPrice > 0 && _priceDeviatesSignificantly(currentPrice, config.lastValidPrice)) { |
There was a problem hiding this comment.
Potential deadlock scenario:
- Vault price stays fixed for a long period of time (e.g. Trevee hack)
- Vault price suddenly jumps up due to fund recovery
- Vault always returns old stale price marked as fresh
|
Deferring ERC4626 integrations due to risk and lack of real yield and lack of harvest mechanism for KAT tokens in Yearn vaults |

No description provided.