yearn / seafood

Seafood
https://seafood.yearn.watch
13 stars 21 forks source link

Use TBD if strategy contract fails to return name #82

Closed murderteeth closed 2 years ago

murderteeth commented 2 years ago

There's a strategy at 0x016919386387898E4Fa87c7c4D3324F75f178F12 currently used in the USDT 0.4.3 vault on Ethereum that reverts when its name function is called. Looking at the strategy's code I see:

function name() external view override returns (string memory) {
    return string(abi.encodePacked("StrategyIdleV2 ", IIdleTokenV4(idleYieldToken).name()));
}

That is, the strategy's name depends on the name of the strategy's idleYieldToken. Checking etherscan I see:

image

Note that idleYieldToken is set to the zero address which causes IdleTokenV4(idleYieldToken).name() to revert.

Side note.. instead of showing an error for name, it looks like etherscan shows the function's documentation from BaseStrategy.sol:

/**
 * @notice This Strategy's name.
 * @dev
 *  You can use this field to manage the "version" of this Strategy, e.g.
 *  `StrategySomethingOrOtherV1`. However, "API Version" is managed by
 *  `apiVersion()` function above.
 * @return This Strategy's name.
 */
function name() external view virtual returns (string memory);

I looked around yearn's github for guidance on how to handle this and reproduced what I found here in the subgraph: https://github.com/yearn/yearn-vaults-v2-subgraph/blob/main/src/utils/strategy/strategy.ts#L54

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
seafood ✅ Ready (Inspect) Visit Preview Sep 2, 2022 at 4:28AM (UTC)