Revert error #6678
Unanswered
fuzzylogic102
asked this question in
Q&A
Revert error
#6678
Replies: 2 comments 2 replies
-
i wish you could share your price converter code with me |
Beta Was this translation helpful? Give feedback.
1 reply
-
is this the error you are referring to?
Gas estimation errored with the following message (see below). The
transaction execution will likely fail. Do you want to force sending?
Returned error: contract creation code storage out of gas [object Object]
…On Sun, 7 Jul 2024 at 19:10, fuzzylogic102 ***@***.***> wrote:
' ' '
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import
***@***.***/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
library PriceConverter {
event Price(uint256 price);
event ConversionRate(uint256 ethAmount, uint256 ethAmountInUsd);
function getPrice() internal returns (uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(
0x694AA1769357215DE4FAC081bf1f309aDC325306
);
(, int256 answer, , , ) = priceFeed.latestRoundData();
uint256 price = uint256(answer * 10000000000);
emit Price(price); // Debugging event
return price;
}
function getConversionRate(uint256 ethAmount) internal returns (uint256) {
uint256 ethPrice = getPrice();
uint256 ethAmountInUsd = (ethPrice * ethAmount) / 1000000000000000000;
emit ConversionRate(ethAmount, ethAmountInUsd); // Debugging event
return ethAmountInUsd;
}
}
' ' '
When debugging, it is reverting when calling the latestRoundData(). The
address is the correct address for the ETH/USD contract on the Sepolia
network
—
Reply to this email directly, view it on GitHub
<#6678 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3WERWVF4PDVHM2F2RXLUG3ZLGACLAVCNFSM6AAAAABKOQ6N2WVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TSOBQGU4TI>
.
You are receiving this because you commented.Message ID:
<smartcontractkit/full-blockchain-solidity-course-js/repo-discussions/6678/comments/9980594
@github.com>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a problem when trying to run a simple contract, I added a receive and fallback function and called the fund() function to receive accidental payments to my contract. I always get this error" transact to FundMe.(receive) errored: Error occurred: revert.
revert
The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.
You may want to cautiously increase the gas limit if the transaction went out of gas." this is my code // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./PriceConverter.sol";
error NotOwner();
contract FundMe{
}
Beta Was this translation helpful? Give feedback.
All reactions