Closed Liam-Hughes closed 2 years ago
For me, grouping every exponentiation in FundMe.sol somehow works (e.g. uint256 minimumUSD = 50 * (10**18);
.
Can you try?
Hi all! Could you please ask these questions on the main repo? Thank you!
https://github.com/smartcontractkit/full-blockchain-solidity-course-py
I asked this question in the main repo: https://github.com/PatrickAlphaC/brownie_fund_me/issues/34
I keep coming up with 2500000 when running scripts.fund_and_withdraw.py.
I've seen some other people running into this but their fixes did not work for me.
Please let it be something bleedingly obvious wrong with me code. fingers crossed.
Here is my code:
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()
FundMe.sol:
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract FundMe { using SafeMathChainlink for uint256;
}
deploy.py:
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract FundMe { using SafeMathChainlink for uint256;
}
helpful_scripts:
from brownie import network, config, accounts, MockV3Aggregator from web3 import Web3
DECIMALS = 8 STARTING_PRICE = 200000000000 LOCAL_BLOCKCHAIN_ENVIRONMENTS = ["development", "ganache-local"]
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, STARTING_PRICE, {"from": get_account()}) print("Mocks Deployed!")
Any and all advice is appreciated!