Last active
January 15, 2023 04:21
-
-
Save shobhitic/54250ba4519052385af66b0864b712a2 to your computer and use it in GitHub Desktop.
Testing on real blockchain data without tokens - https://www.youtube.com/watch?v=VGZb2orvYJE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity >=0.7.0 <0.9.0; | |
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
contract Checker { | |
function check(address _token, address user) view public returns (uint256) { | |
return IERC20(_token).balanceOf(user); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to create hardhat project | |
npx hardhat init | |
// to run a local blockchain | |
npx hardhat node | |
// to fork a blockchain and run locally | |
npx hardhat node --fork "RPC_URL" | |
// to connect to locally running blockchain node | |
npx hardhat console --network localhost |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("@nomicfoundation/hardhat-toolbox"); | |
/** @type import('hardhat/config').HardhatUserConfig */ | |
module.exports = { | |
solidity: "0.8.17", | |
networks: { | |
hardhat: { | |
forking: { | |
url: "https://cloudflare-eth.com/", | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome, thanks for this. You are really great teacher and programmer. 😘