smartcontractkit / full-blockchain-solidity-course-js Goto Github PK
View Code? Open in Web Editor NEWLearn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
Learn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
I am following the YT video and am at 10:59:00 now thw contract is neither being verified nor any error is being displayed :-)
verify.js
is as follow
const {run} = require("hardhat")
const verify = async (contractAddress, args)=>{
console.log("Veryfing contract" +contractAddress)
try {
await run("verify:verify", {
address: contractAddress,
constructorArguments: args,
});
console.log("verified at "+contractAddress)
} catch (e) {
if (e.message.toLowerCase().includes("verified")) {
console.log("Already Verified");
} else console.log(e);
}
}
module.exports = {verify}
Here is the output
sulabh@BTECH2006510:/mnt/c/projects/block/hardhat-fund-me$ yarn hardhat deploy --network rinkeby
yarn run v1.22.15
warning package.json: No license field
$ /mnt/c/projects/block/hardhat-fund-me/node_modules/.bin/hardhat deploy --network rinkeby
Nothing to compile
rinkeby
reusing "FundMe" at 0xEB738b09d9eBF8Ad6F79Dad1269D908eE8a37338
Veryfing contract0xEB738b09d9eBF8Ad6F79Dad1269D908eE8a37338
---------------------------------------
Done in 124.25s.
Please delete it, created by mistake.
Thanks
Lesson 2
No response
Windows
i wish i had an understanding as to why this will not allow me to complete my struct command, this is my 3rd time going over this section from the start and i am not trying to do this all over again. I just want people to show up on my deployed contract.
This seemed to get rid of the TypeError, however, my function getters seem to be returning an empty promise.
Here is my numPlayers code:
const [numPlayers, setNumPlayers] = useState("0");
const { runContractFunction: getNumPlayers } = useWeb3Contract({
abi: abi,
contractAddress: raffleAddress, //specify networkId
functionName: "getNumPlayers",
params: {},
});
const numPlayersFromCall = await getNumPlayers().toString();
Originally posted by @RevanthGundala in #165 (reply in thread)
Hi Patrick,
Absolutely love your YouTube content. Been working through your latest course featuring this repo and it's been great. I'm stuck at hh deploy at around 15:20:00 and I cannot for the life of me figure it out. I've tried everything for the last 5 hours or so. Here's the error I keep getting:
I'm stuck to be honest. I've tried everything, uninstalling with package.json, switching around versions. Keep getting this error. If I clone this repo everything compiles as in your lecture, however.
I'm about to give up and just continue with your repo, but it's a shame. Any ideas on what I'm missing here? Thanks sir.
In a lot of my tests I used anon functions, this is an anti-pattern. Remove anon functions in tests across repos.
All repos have .gitignore
files, make sure they all have .env
and .encryptedKey.json
in them. As well as node_modules
Lesson 7
https://youtu.be/gyMwXuJrbJQ?list=PLyag8AsLVlQxjlVqS7zs7sbOMzG3hrk5u&t=39181
Windows
Am getting this error after importing the MockV3Aggregator test code from node modules
@chainlink/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol:7:38: TypeError: Interfaces cannot inherit.
interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface
I have tried to modifiy the solidity compiler version in hardhat-config file like this but the code wont compile
module.exports = {
solidity: {
compilers: [{ version: '0.8.8' }, { version: '0.6.0' }],
},
defaultNetwork: 'hardhat',
networks: {
ropsten: {
url: process.env.ROPSTEN_URL || '',
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
currency: 'USD',
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
namedAccounts: {
deployer: {
default: 0,
},
},
}
See title
Error: ERROR processing /home/hh-fcc/hardhat-smartcontract-lottery-fcc/deploy/01-deploy-raffle.js:
Error: invalid contract address or ENS name (argument="addressOrName", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.6.2)
======================================================================================
Terminal is returning the above error after deploying mocks when running hh deploy
or yarn hardhat deploy
[15:19:55]
I was unable to find a solution online & my 01-deploy-raffle.js seems identical from the one in the course. I also have watched the entire lesson from the beginning once again but still unable to figure out the issue.
Does anyone have a suggestion on how to fix this bug, plz?
Originally posted by @DorianDaSilva in #682
In the course resource section of the README, the
Github Discussions
Ask questions and chat about the course here!
is pointing towards https://github.com/smartcontractkit/full-blockchain-solidity-course-py/discussions
and should be https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions
Hi, I am following the tutorial for Lesson 5 using WSL 2 Ubunto. Currently, I am on timestamp 7:07:32
When I try to deploy node.js, I receive an error that says I could not detect a network.
Here are the versions I am using:
node: v16.14.2
yarn: 1.12.19
I am sure Ganache is working. I have tried looking in forums, and StackOverflow but do not find anything that works. There are others that have the same issue and have not found an answer. So if I manage to fix this error, I will also make sure to help others.
Excuse me for the improperly asked question. This is my first ever issue on GitHub.
Deploying, please way...
Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8)
at Logger.makeError (/home/georgi_nedyalkov/fcc-hh-tutorial/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:233:21)
at Logger.throwError (/home/georgi_nedyalkov/fcc-hh-tutorial/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:242:20)
at JsonRpcProvider.<anonymous> (/home/georgi_nedyalkov/fcc-hh-tutorial/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:561:54)
at step (/home/georgi_nedyalkov/fcc-hh-tutorial/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
at Object.next (/home/georgi_nedyalkov/fcc-hh-tutorial/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
at fulfilled (/home/georgi_nedyalkov/fcc-hh-tutorial/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:20:58)
at runNextTicks (node:internal/process/task_queues:61:5)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7) {
reason: 'could not detect network',
code: 'NETWORK_ERROR',
event: 'noNetwork'
}
const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
// http://127.0.0.1:7545
const provider = new ethers.providers.JsonRpcProvider([
"http://127.0.0.1:7545",
]);
const wallet = new ethers.Wallet(
"2515bc70f606d5615a964972008f03b1fbdf222c66107b02e737e7e191613ecf",
provider
);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying, please way...");
const contract = await contractFactory.deploy();
console.log(contract);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
ethers-simple-storage/SimpleStorage.sol:2:1: SyntaxError: Source file requires different compiler version (current compiler is 0.4.17+commit.bdeb9e52.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.8.8;
I get this error on the 1st line
pragma solidity ^0.8.8;
But when i run the command line: solc --version it returns
Version: 0.8.14+commit.80d49f37.Linux.g++
Note that all compiler options have disappeared from settings and manual update of settings.json is not working either. Can anyone tell me what I am missing, plz? This is extremely upsetting...Thank you
Originally posted by Chandra583 June 8, 2022
https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=25724s
how did they came from from that two files
simplestorage.sol.abi
simplestorage.sol
I can not deploy my Fundme contract into MataMask despiting dividing minimum usd / eth price=50/1100= 0.05 eth.
when i converted it to wei it failed to deploy (Minimum gas fee transaction failed) what could be the issue?
All repos don't have gitpod yet... add it.
@PatrickAlphaC
In deploy script can i not access the SomeContract right after deployment ?. i want to call one of the set methods right after deployments, ethers.getContract("SomeContract")
is throwing error ethers.getContract is not a function
const someContract = await deploy("SomeContract",{
from: deployer,
args: [],
log: true,
waitConfirmations: network.config.blockConfirmations || 1
});
const someC = await ethers.getContract("SomeContract");
Lesson 1
https://youtu.be/gyMwXuJrbJQ?t=1h34m14s
The best video on solidity, blockchain and web3 I've come across. Just wanted to correct what I think was a mistake.
You mentioned at the timestamp added to this issue that max priority fee was the max gas fee we are willing to pay plus the max tip we are willing to give the miners.
From my prior research before taking this course and little additional research I thought that definition applied to max fee rather than max priority fee.
Isn't Max priority fee the total tip we are willing to give the miners?
I'd love further explanation if I am wrong and thanks yet again for this wonderful course.
Lesson 3
https://youtu.be/gyMwXuJrbJQ?t=11510
Windows
contract StorageFactory{
SimpleStorage public simpleStorage;
}
from above a got a warning that this declaration shadows an existing declaration
I cant install dependencies after setting up hardhat, i was not given options to install am them automatically, i ran into the below errors when installing them manually using this command npm install --save-dev @nomiclabs/hardhat-waffle 'ethereum-waffle@^3.0.0' @nomiclabs/hardhat-ethers,
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS C:\Users\PC\Desktop\DEVELOPEMENT\HARDHATDEMO> npm install --save-dev @nomiclabs/hardhat-waffle 'ethereum-waffle@^3.0.0' @nomiclabs/hardhat-ethers 'ethers@^5.0.0'
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/ethereum-waffle
npm ERR! dev ethereum-waffle@"3.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer ethereum-waffle@"^3.2.0" from @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-waffle
npm ERR! dev @nomiclabs/hardhat-waffle@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\PC\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\PC\AppData\Local\npm-cache_logs\2022-06-28T19_22_08_016Z-debug-0.log
PS C:\Users\PC\Desktop\DEVELOPEMENT\HARDHATDEMO>
[Info - 11:14:56 AM] solang language server v0.1.11 initialized
thread 'main' panicked at 'not implemented', src/emit/ewasm.rs:835:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Output terminal returns this error which causes this error on the pragma version declaration
/mnt/c/Users/doria/hardhat-simple-storage-fcc/contracts/SimpleStorage.sol:2:1: SyntaxError: Source file requires different compiler version (current compiler is 0.4.17+commit.bdeb9e52.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.8.8; // 0.8.12 (Latest)
^---------------------^
Seems to be caused by solidity + hardhat extension - I get error on solidity Juan blanco ext, Solang and solhint (All stopped working) but even unistalled errors persist. Help plz, this is an on going issue!
Lesson 5
https://youtu.be/gyMwXuJrbJQ?t=27189
Windows
I could not get Ganache to run properly, so I skipped to hardhat and am having some issues deploying my contract at this phase. Here is the TypeError. I tried googling and searching on the appropriate resources, but can't seem to find the solution.
~/hardhat-fcc/ethers-simple-storage$ node deploy.js
TypeError: Cannot read properties of undefined (reading 'toHexString')
at isHexable (/home/thearkitech/hardhat-fcc/ethers-simple-storage/node_modules/@ethersproject/bytes/lib/index.js:9:21)
at hexlify (/home/thearkitech/hardhat-fcc/ethers-simple-storage/node_modules/@ethersproject/bytes/lib/index.js:175:9)
at new SigningKey (/home/thearkitech/hardhat-fcc/ethers-simple-storage/node_modules/@ethersproject/signing-key/lib/index.js:20:82)
at new Wallet (/home/thearkitech/hardhat-fcc/ethers-simple-storage/node_modules/@ethersproject/wallet/lib/index.js:120:36)
at main (/home/thearkitech/hardhat-fcc/ethers-simple-storage/deploy.js:11:20)
at Object. (/home/thearkitech/hardhat-fcc/ethers-simple-storage/deploy.js:47:1)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
This is my current deploy.js code:
const ethers = require("ethers");
const fs = require("fs-extra");
require("dotenv").config()
// synchronous [solidity]
// asynchronous [javascript]
// http://172.29.144.1:7545S
async function main() {
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.bin","utf8");
const contractFactory = new ethers.ContractFactory(abi,binary,wallet);
console.log("Deploying, please wait...");
const contract = await contractFactory.deploy();//could add overrides here
await contract.deployTransaction.wait(1);
// console.log("Here is the deployment transaction (transaction response): ");
// console.log(contract.deployTransaction);
// console.log("Here is the transaction receipt: ");
// console.log(transactionReceipt);
// console.log("Let's deploy with only transaction data!");
// const nonce = await wallet.getTransactionCount();//auto updates nonce count
// const tx = {
// nonce: nonce,
// gasPrice: "20000000000",
// gasLimit: "1000000",
// to: null,
// value: 0,
// data: "0x608060405234801561001057600080fd5b5061077a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80632e64cec11461005c5780636057361d1461007a5780636f760f41146100965780638bab8dd5146100b25780639e7a13ad146100e2575b600080fd5b610064610113565b6040516100719190610533565b60405180910390f35b610094600480360381019061008f9190610476565b61011c565b005b6100b060048036038101906100ab919061041a565b61012f565b005b6100cc60048036038101906100c791906103d1565b6101bf565b6040516100d99190610533565b60405180910390f35b6100fc60048036038101906100f79190610476565b6101ed565b60405161010a92919061054e565b60405180910390f35b60008054905090565b8060008190555060005460008190555050565b600260405180604001604052808381526020018481525090806001815401808255809150506001900390600052602060002090600202016000909190919091506000820151816000015560208201518160010190805190602001906101959291906102a9565b505050806001836040516101a9919061051c565b9081526020016040518091039020819055505050565b6001818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b600281815481106101fd57600080fd5b906000526020600020906002020160009150905080600001549080600101805461022690610647565b80601f016020809104026020016040519081016040528092919081815260200182805461025290610647565b801561029f5780601f106102745761010080835404028352916020019161029f565b820191906000526020600020905b81548152906001019060200180831161028257829003601f168201915b5050505050905082565b8280546102b590610647565b90600052602060002090601f0160209004810192826102d7576000855561031e565b82601f106102f057805160ff191683800117855561031e565b8280016001018555821561031e579182015b8281111561031d578251825591602001919060010190610302565b5b50905061032b919061032f565b5090565b5b80821115610348576000816000905550600101610330565b5090565b600061035f61035a846105a3565b61057e565b90508281526020810184848401111561037b5761037a61070d565b5b610386848285610605565b509392505050565b600082601f8301126103a3576103a2610708565b5b81356103b384826020860161034c565b91505092915050565b6000813590506103cb8161072d565b92915050565b6000602082840312156103e7576103e6610717565b5b600082013567ffffffffffffffff81111561040557610404610712565b5b6104118482850161038e565b91505092915050565b6000806040838503121561043157610430610717565b5b600083013567ffffffffffffffff81111561044f5761044e610712565b5b61045b8582860161038e565b925050602061046c858286016103bc565b9150509250929050565b60006020828403121561048c5761048b610717565b5b600061049a848285016103bc565b91505092915050565b60006104ae826105d4565b6104b881856105df565b93506104c8818560208601610614565b6104d18161071c565b840191505092915050565b60006104e7826105d4565b6104f181856105f0565b9350610501818560208601610614565b80840191505092915050565b610516816105fb565b82525050565b600061052882846104dc565b915081905092915050565b6000602082019050610548600083018461050d565b92915050565b6000604082019050610563600083018561050d565b818103602083015261057581846104a3565b90509392505050565b6000610588610599565b90506105948282610679565b919050565b6000604051905090565b600067ffffffffffffffff8211156105be576105bd6106d9565b5b6105c78261071c565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b83811015610632578082015181840152602081019050610617565b83811115610641576000848401525b50505050565b6000600282049050600182168061065f57607f821691505b60208210811415610673576106726106aa565b5b50919050565b6106828261071c565b810181811067ffffffffffffffff821117156106a1576106a06106d9565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b610736816105fb565b811461074157600080fd5b5056fea264697066735822122071e19bb4890c5bad4bbb19b7844c2eea0e1be6d3a977d51f7802315910422eee64736f6c63430008070033",
// chainID: 31337,
// };
// const sentTxResponse = await wallet.sendTransaction(tx);
// await sentTxResponse.wait(1);
// console.log(sentTxResponse);
const currentFavoriteNumber = await contract.retrieve();
console.log(`Current Favorite Number: ${currentFavoriteNumber.toString()}`);
const transactionResponse = await contract.store("7");
const transactionReceipt = await transactionResponse.wait(1);
const updatedFavoriteNumer = await contract.retrieve();
console.log(`Updated favorite number is: ${updatedFavoriteNumber}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1);
});
@PatrickAlphaC
How can i test the withdrawProceeds that it should revert with the NftMarketplace__TransferFailed();
error ?
function withdrawProceeds() external {
uint256 proceeds = s_proceeds[msg.sender];
if(proceeds <= 0){
revert NftMarketplace__NoProceeds();
}
s_proceeds[msg.sender] = 0;
(bool success,) = payable(msg.sender).call{value: proceeds}("");
if(!success){
revert NftMarketplace__TransferFailed();
}
}
Make a PR to the chainlink github with the style guide officially laid out.
AssertionError: Expected transaction to be reverted with You need to spend more ETH!, but other exception was thrown: Error: Transaction reverted: function returned an unexpected amount of data
I was getting this error when runinning test for fundMe() around 11:20:38 of the video
describe("FundMe", async function () {
let fundMe;
let deployer;
let MockV3Aggregator;
beforeEach(async function () {
deployer = (await getNamedAccounts()).deployer;
await deployments.fixture(["all"]);
fundMe = await ethers.getContract("FundMe", deployer);
MockV3Aggregator = await ethers.getContract("MockV3Aggregator", deployer);
});
describe("constructor", async function () {
it("sets the aggregator addresses correctly", async function () {
const response = await fundMe.priceFeed();
assert.equal(response, MockV3Aggregator.address);
});
});
describe("fund", async function () {
it("Fails if you don't send enough ETH", async function () {
await expect(fundMe.fund()).to.be.revertedWith(
"You need to spend more ETH!"
);
});
});
});
After some research it seemed that the issue could ber esolved by downloading @nomicslabs/hardhat-waffle from hardhat docs
[https://hardhat.org/plugins/nomiclabs-hardhat-waffle]
But after running the install I now get the following error running the above test
1) FundMe
"before each" hook for "sets the aggregator addresses correctly":
TypeError: ethers.getContract is not a function
Any ideas of what could be the issue here? thank you!
I am getting the following errors after trying to run
node deploy.js
with Ganache UI
Box on lower left of the screen when editing settings.json>>>
solc error: TypeError: solc.compileStandardWrapper is not a function
Terminal>>>
TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')
SimpleStorage.sol - line 2
pragma solidity ^0.8.14
SyntaxError: Source file requires different compiler version (current compiler is 0.4.17+commit.bdeb9e52.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.8.14;
NOTE: Compiler was working fine and version was set properly.
Compiler version must be fixed [compiler-fixed]
Everything was fine before trying to deploy to ganache
async function main() {
const provider = new ethers.provider.JsonRpcProvider("HTTP://0.0.0.0:8545");
const wallet = new ethers.Wallet(
"c893......................6c9a13081",
provider
);
Now, all compiler settings have disappeared from preferences, only get the option to edit json file and settings.json edits are not working.
Can anyone tell me what the hell is going on and how to fix this, plz?
Error: ERROR processing /home/hh-fcc/hardhat-smartcontract-lottery-fcc/deploy/01-deploy-raffle.js:
Error: invalid contract address or ENS name (argument="addressOrName", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.6.2)
======================================================================================
Terminal is returning the above error after deploying mocks when running hh deploy
or yarn hardhat deploy
I was unable to find a solution online & my 01-deploy-raffle.js seems identical from the one in the course.
Does anyone have a suggestion on how to fix this bug, plz?
We have a bunch of links right now that are looking for supporting material. You can do a quick search on the repo for ]()
and you'll find a bunch of hyperlinks that need to be added.
Including the special guest socials.
$ /home/ionmind/hardhat-fundme-fcc/node_modules/.bin/hardhat deploy --network rinkeby
Error HH606: The project cannot be compiled, see reasons below.
These files import other files that use a different and incompatible version of Solidity:
* contracts/test/MockV3Aggregator.sol (^0.8.12) imports @chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol (^0.6.0)
To learn more, run the command again with --verbose
Read about compiler configuration at https://hardhat.org/config
After getting this error I modified the hardhat.config.js file as instructed on the video
module.exports = {
//solidity: "0.8.12",
solidity: {
compilers: [{ version: "0.8.12" }, { version: "0.6.0" }],
},
But still getting the error, so I also modified the compiler version in solhint.js file
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "^0.8.12", "^0.6.0"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"var-name-mixedcase": "off",
"avoid-low-level-calls": "off"
}
}
But still getting the error. I will create a new copy of the contract in test on v0.8.12 and import locally into mockV3Aggregator as a temporary fix but it would be very helpful if someone could help me understand what I am doing wrong here for future references.
Thank you!
yarn hardhat deploy --tags mocks
returns
Error: expected 0 constructor arguments, got 2
after running line
local detected! Deploying mocks...
An unexpected error occurred:
Checked my code several times but all seems identical to video lesson. Help plz!
the youtube video has no subtitle, it is not Very inconvenient。
solc error: TypeError: solc.compileStandardWrapper is not a function
I am getting this error when I try to edit settings.json to modify compiler version. Anyone knows how to solve this issue?
Hi Patrick,
First thank you for this amazing content. Especially concerning low level calls, I was struggling finding a good intro and your one is perfect.
In your readme (https://github.com/smartcontractkit/full-blockchain-solidity-course-js), section : Lesson 14 Recap, the link "Knowing and controlling your Smart Contract Address" is redirecting to the same link as "From Solidity to byte code". If you remember the doc you wanted to put, maybe you could try to replace with the correct version :)
If a couple of code examples, I used async function
in the describe
block - that keyword should be removed.
Compiler debug log:
Error! Unable to generate Contract ByteCode and ABI
Found the following ContractName(s) in source code : SimpleStorage
But we were unable to locate a matching bytecode (err_code_2)
For troubleshooting, you can try compiling your source code with the [Remix - Solidity IDE](https://remix.ethereum.org/) and check for exceptions
I am getting this error message when trying to verify & publish SimpleStorage.sol at the end of the lesson
This is my SimpleStorage contract - Compiled and deployed perfectly (Compiler v0.8.12)
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.8; // 0.8.12 (Latest)
contract SimpleStorage {
uint256 favoriteNumber;
mapping(string => uint256) public nameToFavoriteNumber;
//The string (name) is being mapped to favoriteNumber
//Index starts iterating at 0
struct People {
uint256 favoriteNumber;
string name;
}
People[] public people;
function store(uint256 _favoriteNumber) public virtual {
favoriteNumber = _favoriteNumber;
}
function retrieve() public view returns(uint256){
return favoriteNumber;
}
//calldata, memory, storage
function addPerson(string memory _name, uint256 _favoriteNumber) public {
people.push(People(_favoriteNumber, _name));
nameToFavoriteNumber[_name] = _favoriteNumber;
}
}
Thank you!
As per title, for the lottery VRF implementation, I've followed the steps and have been met with the VRF being stuck twice.
Localhost/Hardhat works fine in the unit tests, but the staging is stuck due to Chainlink VRF being unable to go through.
Here's the contract address.
Every "section" of the video is separated by a clip of what's in ./img/hh-fcc-background.png
. We currently have the title text of each section in this repo, but we don't have the timestamp in here!
Can anyone please help me understand this part, i understood the part 0.95
wherein if we can borrow 10, in that case we are just borrowing the 95% of the DAI, last reciprocal part i didn't understand why do we even need that. sorry for the dumb math question
const amountDaiToBorrow = availableBorrowsETH.toString() * 0.95 * (1 / daiPrice.toNumber());
FundMe
constructor
1) "before each" hook for "sets the aggregator addresses correctly"
0 passing (754ms)
1 failing
1) FundMe
"before each" hook for "sets the aggregator addresses correctly":
ERROR processing /home/me/hardhat-fundme-fcc/deploy/00-deploy-mocks.js:
Error: expected 0 constructor arguments, got 2
I am getting this error when running cmd line on FundMe.test.js:
$ yarn hardhat test
00-deploy-mocks.js deployed properly in the previous section & code is identical to the video. Not sure what the issue is, any input is welcome. Thank you!
$ /home/ionmind/hardhat-fundme-fcc/node_modules/.bin/hardhat deploy --network rinkeby
Error HH606: The project cannot be compiled, see reasons below.
These files import other files that use a different and incompatible version of Solidity:
* contracts/test/MockV3Aggregator.sol (^0.8.12) imports @chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol (^0.6.0)
To learn more, run the command again with --verbose
Read about compiler configuration at https://hardhat.org/config
After getting this error I modified the hardhat.config.js file as instructed on the video
module.exports = {
//solidity: "0.8.12",
solidity: {
compilers: [{ version: "0.8.12" }, { version: "0.6.0" }],
},
But still getting the error, so I also modified the compiler version in solhint.js file
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "^0.8.12", "^0.6.0"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"var-name-mixedcase": "off",
"avoid-low-level-calls": "off"
}
}
But still getting the error.
I created a separate AggregatorV2V3Interface file in test folder, locally imported into MockV3Aggregator.sol & also declared solidity version ^0.8.12 for each of the files
//SPDX-License-Identifier:MIT
pragma solidity ^0.8.12;
interface AggregatorInterface {
//Code Here//
}
interface AggregatorV3Interface {
//Code Here//
}
interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {}
//SPDX-License-Identifier:MIT
pragma solidity ^0.8.12;
import "./AggregatorV2V3Interface.sol";
There are no errors or warnings in the code but I still get the same error when trying to compile. I don't get why I seem to be the only person having this compiler issue.
Any help is appreciated. Thank you!
My raffle contract deploys perfectly fine, after deploying the contract https://rinkeby.etherscan.io/address/0x2FBeaAFdacb7116CD5258d64ee102E908addEc85
https://vrf.chain.link/rinkeby/6148
After all theses steps.. i ran the staging test ... it initiated the test, entered into the raffle. after 30 seconds performUpkeep triggered.it even emitted the requestId https://rinkeby.etherscan.io/tx/0xb72ed45c229ecf369459c55e05d91a3ca49cf2c0919b0c02d85c717f6e94ec96#eventlog
But in VRF sub , it still shows pending, waited for almost 24hours for the first time :(. i thought i did something wrong so tried the whole process again. after the performUpkeep the vrf shows it in pending. i also checked the
VRFCoordinatorV2 rinkeby contract pendingRequestExists('6148')
with my subId it returns true
https://rinkeby.etherscan.io/address/0x6168499c0cFfCaCD319c818142124B7A15E857ab#readContract
@PatrickAlphaC what could be the issue ?
| I am getting this error when running the test on addressTo AmountFunded() (11:23:25)
Below is my code (I ran it with & without describe line)
describe("amount funded", async function () {
it("Updated the amount funded data structure", async function () {
await fundMe.fund({ value: sendValue });
const response = await fundMe.addressToAmountFunded(deployer);
assert.equal(response.toString(), sendValue.toString());
});
});
===============================================================================
|I tried checking online but no solution available on any of the forums
Does anyone have an idea of what maybe wrong? Been on this for hours and nothing. Thank you!
If checkUpkeep
is called everytime automatically by keeper and decides on the basis of bool value to call the performUpkeep
or not. Then in our raffle contract does it even make sense to call the checkUpkeep again inside performUpkeep ? will it save gas if we don't call it?
function checkUpkeep(bytes calldata /* checkData */) public override returns(bool upkeepNeeded, bytes memory /* performData */){}
function performUpkeep(bytes calldata /* performData */) external override {
(bool upkeepNeeded, ) = checkUpkeep("");
}
Originally posted by MichaelGKing June 21, 2022
Hello,
I am having trouble running my code on the local hardhat node.
On both Patrick's cloned repo's and my own work I consistently get this error:
Error: Transaction reverted without a reason string
Also in my node terminal, even after resetting my Metamask I get this issue: (block number changes)
Received invalid block tag 4. Latest block number is 3
When cloning Patrick's repo I do everything the Readme says. Except this part, I'm unsure what it means:
Reserve the front end with yarn http-server, input an amount in the text box, and hit fund button after connecting
This is my index.js folder:
// in front-end js you cannot use require, must use import
import { ethers } from "./ethers-5.6.esm.min.js";
import { abi, contractAddress } from "./constants.js";
// Have to add onclick events in js file, due to it being imported as a module type in the HTML.
const connectButton = document.getElementById("connectButton");
const fundButton = document.getElementById("fundButton");
connectButton.onclick = connect;
fundButton.onclick = fund;
console.log(ethers);
async function connect() {
if (typeof window.ethereum != "undefined") {
await window.ethereum.request({ method: "eth_requestAccounts" });
connectButton.innerHTML = "Connected!";
} else {
connectButton.innerHTML = "Please install metamask!";
}
}
// fund function
async function fund() {
const ethAmount = "0.5";
console.log(`Funding with ${ethAmount}...`);
if (typeof window.ethereum != "undefined") {
// provider / connection to the blockchain
// signer / wallet/ someone with some gas
// contract that we are interacting with
// ^ ABI & Address
// Web3Provider objects takes that http end point and automatically sticks it in ethers for us.
// It looks at our metamask and says I found the http endpoint inside their metamask, thats what we are going to use as our provider here.
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contract = new ethers.Contract(contractAddress, abi, signer);
const transactionResponse = await contract.fund({
value: ethers.utils.parseEther(ethAmount),
});
}
}
Any help on the issue would be greatly appreciated.
FYI I just went to get more Rinkeby test coin, with this url: https://rinkebyfaucet.com/
and it has this warning message: Due to ETH Merge, the Rinkeby Testnet will be deprecated soon. Please develop using our Goerli Testnet faucet.
So we we should probably link to Goerli testnet soon.
They all still say "coming soon"...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.