-
|
Hello, When i run deploy.pi i got an error This is my deploy.py from brownie import FundMe, MockV3Aggregator, network, config
from scripts.helpful_scripts import get_account
def deploy_fund_me():
account = get_account()
# pass the price fee adress to our fundMe contract
# if we are on a persistant network like rinkeby, use the associated adress
# otherwise, deploy mocks
if network.show_active() != "development":
price_feed_adress = config["network"][network.show_active()][
"eth_usd_price_feed"
]
else:
print(f"The Active network is {network.show_active()}")
print("Deploying Mocks ...")
mock_aggregator = MockV3Aggregator.deploy(
18, 2000000000000000000000, {"from": account}
)
price_feed_adress = mock_aggregator
print("Mocks Deployed")
fund_me = FundMe.deploy(
price_feed_adress,
{"from": account},
publish_source=["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()The output console 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 topicsand helpful_scripts.py from brownie import network, config, accounts
def get_account():
if network.show_active() == "development":
return accounts[0]
else:
return accounts.add(config["wallets"]["from_key"])Do you know i get this error ? |
Beta Was this translation helpful? Give feedback.
Answered by
cromewar
Mar 12, 2022
Replies: 1 comment 6 replies
-
|
Hello @NinjaTurtles-cloud |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
wilonweb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @NinjaTurtles-cloud
For me seems a problem with your
brownie-config.yamlcould you please share a screenshot of your project folder structure and the code of that file?Additional hint: look up for a indentation error and be sure your key are imported from
.env