Closed joebb10 closed 2 years ago
Is this a compile error? or just VSCode linter telling you that?
Closing for now, feel free to follow up with the command you ran to get that error.
Yes, this is a compile error. I ran "brownie compile" on the terminal. Even the openzeppelin forum doesn't know what is happening with this code. I've also tried to copy and paste the code from this repository and it didn't work.
Can you do a step by step of every command you ran to get this error starting with git clone
?
You mean the code? If yes, I'm gonna send you all the code I've done.
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Lottery is Ownable {
address payable[] public players;
uint256 public usdEntryFee;
AggregatorV3Interface internal ethUsdPriceFeed;
enum LOTTERY_STATE {
OPEN,
CLOSED,
CALCULATING_WINNER
}
LOTTERY_STATE public lottery_state;
// OPEN = 0
//CLOSED = 1
//CALCULATING_WINNER = 2
LOTTERY_STATE public lottery_state;
constructor(address _priceFeedAddress) public {
usdEntryFee = 50 * (10**18);
ethUsdPriceFeed = AggregatorV3Interface(_priceFeedAddress);
lottery_state = LOTTERY_STATE.CLOSED; // or "lottery_state = 1;
}
function enter() public {
// $50 minimum
require(lottery_state == LOTTERY_STATE.OPEN); // or lottery_state == 0;
require(msg.sender >= getEntranceFee(), "Not enough ETH!");
players.push(msg.sender);
}
function getEntranceFee() public view returns (uint256) {
(, int256 price, , , ) = ethUsdPriceFeed.latestRoundData();
uint256 adjustedPrice = uint256(price) * 10**10; //18 decimals
//50, 2000 / ETH
// 50/2,000
//50 * 100000 / 2000
uint256 costToEnter = (usdEntryFee * 10**18) / adjustedPrice;
return costToEnter;
}
function startLottery() public onlyOwner {
require(
lottery_state == LOTTERY_STATE.CLOSED,
"Can't start a new lottery yet!"
);
lottery_state = LOTTERY_STATE.OPEN;
}
function endLottery() public {
//require(lottery_state == 50.000, "The winner is 50.000");
//lottery_state = LOTTERY_STATE.CALCULATING_WINNER;
}
}
```brownie-config.yaml
dependencies:
- smartcontractkit/chainlink-brownie-contracts@1.1.1
- OpenZeppelin/openzeppelin-contracts@3.4.0
compiler:
solc:
remappings:
- "@chainlink=smartcontractkit/chainlink-brownie-contracts@1.1.1"
- "@openzeppelin=OpenZeppelin/openzeppelin-contracts@3.4.0"
Are u asking for it? If not, what is your question? I didn't understand it. And I've tried to use git clone with the code and it worked normally.
Ahh ok. No I was asking you to walk step by step to getting your error starting with cloning this repo. Sounds like you don't get the issue when you clone the repo and run brownie compile?
Yes, correct. The problem I'm seeing now is that if I clone the repo I get the complete code and I haven't finished the lottery part of the course. I've done the beginning only, that's why I'm still trying to use my code.
Also Patrick, just an idea: If possible make some videos you teaching how to create a dex, cex, etc. I've tried to create it by myself for starting a crypto payment startup, but I couldn't because I haven't found good contents teaching about it.
I've done the beginning only, that's why I'm still trying to use my code.
Ah ok, so you'd need to find out where your differs.
And on that suggestion, thanks! We'll see if I get time to do that ahah.
Thanks either, Patrick! I wish all the best to you. You are the best!
I ran this command on terminal and it solved the issue: git clone https://github.com/PatrickAlphaC/chainlink-mix cd chainlink-mix
It is on the README of this repository. Hope it can help someone.