Replies: 7 comments 15 replies
-
I got the same error I tried fundme.priceFeed without the |
Beta Was this translation helpful? Give feedback.
-
@alymurtazamemon, it would be good if you can leave us a short answer when you have free time to resolve these issues |
Beta Was this translation helpful? Give feedback.
-
It's so great, I solved this problem when I use ethers v6, of course, switching to v5 is the simplest solution. The following is my code using ethers v6. const { assert } = require("chai")
const { deployments, ethers, getNamedAccounts } = require("hardhat")
describe("FundMe", async () => {
let FundMe
let signer
let MockV3Aggregator
beforeEach(async () => {
// don't use (await getNamedAccounts()).deployer, as a parameter to the getContractAt function, it will report an error !!!
const accounts = await ethers.getSigners()
signer = accounts[0]
await deployments.fixture(["all"])
// there is no getContract function in ethers, so using getContractAt
const FundMeDeployment = await deployments.get("FundMe")
FundMe = await ethers.getContractAt(
FundMeDeployment.abi,
FundMeDeployment.address,
signer,
)
const MockV3AggregatorDeployment = await deployments.get(
"MockV3Aggregator",
)
MockV3Aggregator = await ethers.getContractAt(
MockV3AggregatorDeployment.abi,
MockV3AggregatorDeployment.address,
signer,
)
})
describe("constructor", async () => {
it("sets the aggregator address correctly", async () => {
const response = await FundMe.priceFeed()
assert.equal(response, MockV3Aggregator.target) // get address using target instead of address property
})
})
}) |
Beta Was this translation helpful? Give feedback.
-
maybe this code can solve your problem. beforeEach(async function(){
deployer = (await getNamedAccounts()).deployer;
await deployments.fixture(["all"]);
const fundMeDeployment = await deployments.get("FundMe");
fundMe = await ethers.getContractAt(fundMeDeployment.abi, fundMeDeployment.address);
const mockV3AggregatorDeployment = await deployments.get("MockV3Aggregator");
mockV3Aggregator = await ethers.getContractAt(mockV3AggregatorDeployment.abi, mockV3AggregatorDeployment.address);
}) |
Beta Was this translation helpful? Give feedback.
-
hello. I also encountered this problem today. Now I have solved this problem. describe("constructor", async function () {
it("sets the aggregator addresses correctly", async function () {
// AggregatorV3Interface = priceFeed
const response = await fundMe.priceFeed
assert.equal(response.address, mockV3Aggregator.address)
})
}) |
Beta Was this translation helpful? Give feedback.
-
这是来自QQ邮箱的假期自动回复邮件。您好,您的邮件我已经收到,我会尽快回复,谢谢。
|
Beta Was this translation helpful? Give feedback.
-
这是来自QQ邮箱的假期自动回复邮件。您好,您的邮件我已经收到,我会尽快回复,谢谢。
|
Beta Was this translation helpful? Give feedback.
-
Above is my
FundMe.test.ts
. I have tried solutions from issue #5749 but I still get the following error:Error: could not decode result data (value="0x", info={ "method": "priceFeed", "signature": "priceFeed()" }, code=BAD_DATA, version=6.6.4)
Here is
package.json
:Beta Was this translation helpful? Give feedback.
All reactions