Lesson 7: Error = Tx dropped without known replacement (test_can_pick_winner) #485
Answered
by
cromewar
brownandrew1390
asked this question in
Q&A
-
When running a test on
Here is my import pytest
from scripts.deploy_lottery import deploy_lottery
from scripts.helpful_scripts import LOCAL_BLOCKCHAIN_ENVIRONMENTS, fund_with_link, get_account
import time
from brownie import network
def test_can_pick_winner():
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
pytest.skip()
lottery = deploy_lottery()
account = get_account()
lottery.startLottery({"from": account})
lottery.enter({"from": account, "value": lottery.getEntranceFee()})
lottery.enter({"from": account, "value": lottery.getEntranceFee()})
fund_with_link(lottery)
lottery.endLottery({"from": account})
time.sleep(180)
assert lottery.recentWinner() == account
assert lottery.balance() == 0 |
Beta Was this translation helpful? Give feedback.
Answered by
cromewar
Dec 3, 2021
Replies: 1 comment 3 replies
-
Hello @brownandrew1390 I tried to reproduce the error but I couldn't. which network are you using for the integration test?, also it seems to be a problem with your function getEntranceFee() public view returns (uint256) {
(, int256 price, , , ) = ethUsdPriceFeed.latestRoundData();
// set entrance fee to $50
// Eth/Usd conversion has 8 decimals so in order to make it 18 (wei standard) it's necessary to multiply the price.
uint256 adjustedPrice = uint256(price) * (10**10); //18 decimals
uint256 costToEnter = (usdEntryFee * 10**18) / adjustedPrice;
return costToEnter;
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
cromewar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @brownandrew1390 I tried to reproduce the error but I couldn't. which network are you using for the integration test?, also it seems to be a problem with your
getEntranceFee()
function, it should be something like this: