-
Hello
Do you know what it mean ? This is my code from brownie import FundMe, MockV3Aggregator, network, config
from scripts.helpful_scripts import (
get_account,
deploy_mocks,
LOCAL_BLOCKCHAIN_ENVIRONMENTS,
)
def deploy_fund_me():
account = get_account()
if network.show_active() not in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
price_feed_adress = config["network"][network.show_active()][
"eth_usd_price_feed"
]
else:
deploy_mocks()
price_feed_adress = MockV3Aggregator[-1].address
fund_me = FundMe.deploy(
price_feed_adress,
{"from": account},
publish_source=config["networks"][network.show_active()].get("verify"),
)
print(f"Contract deployed to {fund_me.address}")
mock_aggregator = MockV3Aggregator.deploy(
18, 2000000000000000000000, {"from": account}
)
price_feed_address = mock_aggregator.address
print("Mock deployed!")
def main():
deploy_fund_me() helpful_script.py from brownie import network, config, accounts, MockV3Aggregator
from web3 import Web3
LOCAL_BLOCKCHAIN_ENVIRONMENTS = ["devlopment", "ganache-local"]
DECIMALS = 18
STARTING_PRICE = 2000
def get_account():
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
return accounts[0]
else:
return accounts.add(config["wallets"]["from_key"])
def deploy_mocks():
print(f"The Active network is {network.show_active()}")
print("Deploying Mocks ...")
if len(MockV3Aggregator) <= 0:
MockV3Aggregator.deploy(
DECIMALS, Web3.toWei(STARTING_PRICE, "ether"), {"from": get_account()}
)
print("Mocks Deployed!") MockV3Aggregator.sol // SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol";
/**
* @title MockV3Aggregator
* @notice Based on the FluxAggregator contract
* @notice Use this contract when you need to test
* other contract's ability to read data from an
* aggregator contract, but how the aggregator got
* its answer is unimportant
*/
contract MockV3Aggregator is AggregatorV2V3Interface {
uint256 public constant override version = 0;
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) public {
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 view override returns (string memory) {
return "v0.6/tests/MockV3Aggregator.sol";
}
}
// MockOracle
// Function signatures, event signatures, log topics
|
Beta Was this translation helpful? Give feedback.
Answered by
n4n0b1t3
Mar 17, 2022
Replies: 1 comment 11 replies
-
This error message has nothing to do with your scripts. Can you please post here, after you have removed sensitive data, the output of the error from the terminal? |
Beta Was this translation helpful? Give feedback.
11 replies
Answer selected by
wilonweb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This error message has nothing to do with your scripts. Can you please post here, after you have removed sensitive data, the output of the error from the terminal?