getEntranceFee Return not matching up #1247
-
So I went over this a few times, double checked the video and caught some errors, but when I run getEntranceFee() fund_and_withdrawy.py my number returns 2000000 which isn't even close to rate. fund_and_withdraw.py from brownie import FundMe
from scripts.helpful_scripts import get_account
def fund():
fund_me = FundMe[-1]
account = get_account()
entrance_fee = fund_me.getEntranceFee()
print(entrance_fee)
def main():
fund() getEntranceFee (which I have looked at multiple times, i did manually enter it but it seems right function getEntranceFee() public view returns (uint256) {
//minimum USD
uint256 minimumUSD = 50 * 10**18;
uint256 price = getPrice();
uint256 precision = 1 * 10**18;
return (minimumUSD * precision) / price;
} even will include my helpful_scripts.py from lib2to3.pgen2.token import STAR
from brownie import network, config, accounts, MockV3Aggregator
from web3 import Web3
LOCAL_BLOCKCHAIN_ENVIRONMENT = ["development", "ganache-local"]
DECIMALS = 8
STARTING_PRICE = 200000000000
def get_account():
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENT:
return accounts[0]
else:
return accounts.add(config["wallets"]["from_key"])
def deploy_mocks():
print(f"THe active network is {network.show_active()}")
print(f"Deploying Mocks...")
if len(MockV3Aggregator) <= 0:
MockV3Aggregator.deploy(DECIMALS, STARTING_PRICE, {"from": get_account()})
print("Mocks Deployed") Deploying works, everything works but when i Now i spent a day trying to understand all the big numbers back when we did this on remix but now the number is too small? Anyone see anything I did wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
So I still was getting aggravated over this issue. I tried a bunch of things and realized if the issue was in MockV3Aggregator I would have to recompile it. I tried a variety of attempts including deleting my ganache-local, shutting down ganache, restarting it and spinning up a new ganache-local add...this did not work, it kept looking for the original contract address of MockV3Aggregatory (which I verified from the map.json file. I attempted to move that reference from map.json - but that did not work... The solution that made this work was deleting the 1337 file. Then running deploy, both contracts were deployed poroperly and whatever issue I was having before changed and I get the right entry fee. I'm not sure what the problem was but this did fix it. |
Beta Was this translation helpful? Give feedback.
So I still was getting aggravated over this issue. I tried a bunch of things and realized if the issue was in MockV3Aggregator I would have to recompile it. I tried a variety of attempts including deleting my ganache-local, shutting down ganache, restarting it and spinning up a new ganache-local add...this did not work, it kept looking for the original contract address of MockV3Aggregatory (which I verified from the map.json file. I attempted to move that reference from map.json - but that did not work...
The solution that made this work was deleting the 1337 file. Then running deploy, both contracts were deployed poroperly and whatever issue I was having before changed and I get the righ…