![](/img/trans.png)
[英]"VM Exception while processing transaction: revert", when running a chainlink node and try to deploy TestnetConsumer contract?
[英]Chainlink Returned error: VM Exception while processing transaction: revert
我正在 Remix 上測試這段代碼:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
contract PriceConsumerV3 {
AggregatorV3Interface internal priceFeed;
/**
* Network: Kovan
* Aggregator: ETH/USD
* Address: 0x9326BFA02ADD2366b30bacB125260Af641031331
*/
constructor() {
priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
}
/**
* Returns the latest price
*/
function getLatestPrice() public view returns (int) {
(
uint80 roundID,
int price,
uint startedAt,
uint timeStamp,
uint80 answeredInRound
) = priceFeed.latestRoundData();
return price;
}
}
編譯和部署似乎正確執行,但是我收到此錯誤:
調用 PriceConsumerV3.getLatestPrice 出錯:返回錯誤:處理事務時出現 VM 異常:還原
有什么建議嗎?
我在部署到Javascript VM時看到了這個錯誤
這是因為您嘗試調用的合同在您使用的 VM 上不可用。 您需要切換到Injected Web3選項。
部署還需要在您與實際區塊鏈交互時設置錢包。 您引用的示例使用的是 Kovan Tes.net。
這里有幾個其他鏈接供參考
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.