Skip to content

Instantly share code, notes, and snippets.

View mananuf's full-sized avatar

Bankat Mananaf mananuf

View GitHub Profile
import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs";
import {
time,
loadFixture,
} from "@nomicfoundation/hardhat-toolbox/network-helpers";
import { expect } from "chai";
import hre from "hardhat";
// v3: import { network } from "hardhat"
// v3: const { ethers } = network.connect()
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { Error } from "./lib/Error.sol";
import { Event } from "./lib/Event.sol";
import { console } from "forge-std/console.sol";
contract CustomERC20 {
string private _name;
@mananuf
mananuf / gist:9c4efe4c809a7ae82205fd161cca83a5
Last active September 24, 2025 14:39
Solidity Testing
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { Test } from "forge-std/Test.sol";
import { console } from "forge-std/console.sol";
import { CustomERC20 } from "../../contracts/CustomERC20.sol";
import { Error } from "../../contracts/lib/Error.sol";
import { Event } from "../../contracts/lib/Event.sol";
contract CustomERC20Test is Test {
const ethers = require('ethers');
const localStorage = require('localStorage');
const axios = require('axios');
function createHdWallet() {
const HdWallet = ethers.HDNodeWallet.createRandom();
console.log(HdWallet);
// ethers.HDNodeWallet.fromSeed(HdWallet.mnemonic.computeSeed())
const ethers = require('ethers');
const localStorage = require('localStorage');
function generateMnemonic() {
let randomEntropyBytes = ethers.utils.randomBytes(16);
return ethers.utils.entropyToMnemonic(randomEntropyBytes);
}
function createHdWallet() {
Implement contract inheritance, where the parent contract implements 3 setter functions, and two getter functions. The child contract should be able to override one of the parent contract.
@mananuf
mananuf / gist:644dba0b4b75dfe26a1535dbdffd123b
Last active September 11, 2024 13:46
Bankat Class Work
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract ParentContract {
uint256 public firstVal;
uint256 public secondVal;
string public stringVal;
function setFirstValue(uint256 _value) public virtual {
firstVal = _value;