truffle.js:
var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "";
module.exports = {
networks: {
testnet: {
provider: () => new HDWalletProvider(mnemonic, ""),
network_id: 97,
confirmations: 10,
timeoutBlocks: 200,
skipDryRun: true
},
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
},
rinkeby: {
host: '127.0.0.1',
port: 8545,
network_id: 4,
gasPrice: "20000000000", // 20 gwei
},
live: {
host: "127.0.0.1",
port: 8545,
network_id: "1", // Only mainnet
gasPrice: "10000000000", // 10 gwei
gas: "5000000", // 0.02 eth at 4 gwei price
},
compilers: {
solc: {
version: "^0.8.4",
},
},
}
};
But I keep getting the error: Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragma solidity >=0.8.4"
.
I have even tried the solutions in How to upgrade solidity compiler in truffle, but none helped.
How can I fix this?