Hello there. I am following the 3rd tutorial " How to Build Serverless Dapps Part 1 - Web3.js & Moralis Programming Tutorial". I am up to the part where flipcontract.sol is first compiled. I get this error like in the tutorialā¦
Compiling your contractsā¦
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/flipcontract.sol
/home/blair/Moralis_tutorials/build_serverless_dapp/truffle/contracts/flipcontract.sol:4:1: ParserError: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.7.5;
^---------------------^
I adjusted the solidity version in compiler settings of the truffle_config.js file to 0.7.5; although when running it I got this error
Compiling your contractsā¦
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/flipcontract.sol
> Compiling ./node_modules/@openzeppelin/contracts/access/Ownable.sol
> Compiling ./node_modules/@openzeppelin/contracts/math/SafeMath.sol
> Compiling ./node_modules/@openzeppelin/contracts/utils/Context.sol
> Compilation warnings encountered:
** /home/blair/Moralis_tutorials/build_serverless_dapp/truffle/contracts/flipcontract.sol: Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use āSPDX-License-Identifier: UNLICENSEDā for non-open-source code. Please see https://spdx.org for more information.**
,/home/blair/Moralis_tutorials/build_serverless_dapp/truffle/node_modules/@openzeppelin/contracts/access/Ownable.sol:26:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it āabstractā is sufficient.
** constructor () internal {**
** ^ (Relevant source part starts here and spans across multiple lines).**
/home/blair/Moralis_tutorials/build_serverless_dapp/truffle/contracts/flipcontract.sol:54:1: DeclarationError: Identifier already declared.
contract FlipContract is Ownable {
^ (Relevant source part starts here and spans across multiple lines).
/home/blair/Moralis_tutorials/build_serverless_dapp/truffle/contracts/flipcontract.sol:6:1: The previous declaration is here:
contract FlipContract is Ownable {
^ (Relevant source part starts here and spans across multiple lines).
Compilation failed. See above.
Is there a known way around this? thank you