if you don't install smartcontractkit/chainlink-brownie-contracts #3886
vincentyao
started this conversation in
Show and tell
Replies: 3 comments 3 replies
-
|
I am not sure I understand what you mean @vincentyao, Do you mean |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
No, what I want to say is that maybe some people didn't install “chainlink-brownie-contracts” at the very beginning.
Then they might encounter confusion and problems when updating the “MockV3Aggregator”according to the video.
Like me for example. And then I did some debugging and made a sharing on how to find the corresponding “MockV3Aggregator” and update the relevant code if what is installed is the chain-link-contracts I mentioned. I hope it can be helpful if anyone encounters the same situation.
Thank you for your attention.
Best regards,
…---Original---
From: ***@***.***>
Date: Tue, Apr 15, 2025 01:08 AM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [Cyfrin/foundry-full-course-cu] if you don't installsmartcontractkit/chainlink-brownie-contracts (Discussion #3886)
I am not sure I understand what you mean @vincentyao, Do you mean chainlink-brownie-contracts does not have the MockV3Aggregator contract anymore?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
|
No mentioned, sir
Thanks for your reply.
…---Original---
From: ***@***.***>
Date: Tue, Apr 15, 2025 04:31 AM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [Cyfrin/foundry-full-course-cu] if you don't installsmartcontractkit/chainlink-brownie-contracts (Discussion #3886)
I see, Thanks for the heads-up.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If you don't install smartcontractkit/chainlink-brownie-contracts, you can refer to this code that i have tested in my local, it is worked for me.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {AggregatorV2V3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV2V3Interface.sol";
/**
*/
// solhint-disable
contract MockV3Aggregator is AggregatorV2V3Interface {
uint256 public constant override version = 4;
uint8 public override decimals;
int256 public override latestAnswer;
uint256 public override latestTimestamp;
uint256 public override latestRound;
mapping(uint256 => int256) public override getAnswer;
mapping(uint256 => uint256) public override getTimestamp;
mapping(uint256 => uint256) private getStartedAt;
constructor(uint8 _decimals, int256 _initialAnswer) {
decimals = _decimals;
updateAnswer(_initialAnswer);
}
function updateAnswer(int256 _answer) public {
latestAnswer = _answer;
latestTimestamp = block.timestamp;
latestRound++;
getAnswer[latestRound] = _answer;
getTimestamp[latestRound] = block.timestamp;
getStartedAt[latestRound] = block.timestamp;
}
function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public {
latestRound = _roundId;
latestAnswer = _answer;
latestTimestamp = _timestamp;
getAnswer[latestRound] = _answer;
getTimestamp[latestRound] = _timestamp;
getStartedAt[latestRound] = _startedAt;
}
function getRoundData(
uint80 _roundId
)
external
view
override
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
{
return (_roundId, getAnswer[_roundId], getStartedAt[_roundId], getTimestamp[_roundId], _roundId);
}
function latestRoundData()
external
view
override
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
{
return (
uint80(latestRound),
getAnswer[latestRound],
getStartedAt[latestRound],
getTimestamp[latestRound],
uint80(latestRound)
);
}
function description() external pure override returns (string memory) {
return "v0.8/shared/mocks/MockV3Aggregator.sol";
}
}
Because if you installed a real contract, it isn't smartcontractkit/chainlink-brownie-contracts;
It is smartcontractkit/chainlink/tree/develop/contracts.
The video in Patric‘s made the mock function; maybe there is a difference.
If you have any questions, feel free to leave a comment here and let me know
Best regards,
Beta Was this translation helpful? Give feedback.
All reactions