I am currently testing using this GitHub repo : https://github.com/oed/bonding-curves
truffle.js
looks like this below:
const HDWalletProvider = require("truffle-hdwallet-provider");
const TestRPC = require("ganache-cli");
let provider
function getNmemonic() {
try{
return require('fs').readFileSync("./seed", "utf8").trim();
} catch(err){
return "";
}
}
function getProvider(rpcUrl) {
if (!provider) {
provider = new HDWalletProvider(getNmemonic(), rpcUrl)
}
return provider
}
module.exports = {
networks: {
development: {
get provider() {
if (!provider) {
provider = TestRPC.provider({total_accounts: 25})
}
return provider
},
network_id: "*"
},
local: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
},
ropsten: {
get provider() {
return getProvider("https://ropsten.infura.io/")
},
gas: 4004580,
network_id: 3
},
rinkeby: {
get provider() {
return getProvider("https://rinkeby.infura.io/")
},
network_id: 4
},
infuranet: {
get provider() {
return getProvider("https://infuranet.infura.io/")
},
network_id: "*"
},
kovan: {
get provider() {
return getProvider("https://kovan.infura.io/")
},
gas: 4004580,
network_id: 42
},
mainnet: {
get provider() {
return getProvider("https://mainnet.infura.io/")
},
gas: 1704580,
gasPrice: 1000000000,
network_id: 1
}
}
};
But seems like I could deploy the contracts without any infura's API_KEY but I don't know why.
Usually what I've done with my past experiences, I thought I need to add API_KEY
after the infura url such as :
https://ropsten.infura.io/API_KEY
But after adding the deploy script and npm run deploy-ropsten
command, looks like migration success.
Can anyone help me why?