在 Solidity 中,接口无法继承其他接口或合约。因此,如果 AggregatorV2V3Interface 尝试继承其他接口,则会出现该错误。要解决此问题,可以将其更改为实现(implement)其他接口或合约,而不是继承它们。
以下是示例代码,展示如何将 AggregatorV2V3Interface 更改为实现其他接口而不是继承它们:
interface IAggregatorV2V3Base {
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external view returns (int256);
function getTimestamp(uint256 roundId) external view returns (uint256);
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);
event NewRound(uint256 indexed roundId, address indexed startedBy);
}
interface IAggregatorV3 is IAggregatorV2V3Base {
function decimals() external view returns (uint8);
}
contract AggregatorV2V3Interface is IAggregatorV3 {}
下一篇:编译ALTERTABLEworkspecADDCOLUMNrun_in_foregroundINTEGERNOTNULLDEFAULT0时出现了重复列名run_in_foreground的错误