Skip to content

Instantly share code, notes, and snippets.

View hackingbeauty's full-sized avatar
🎯
Focusing

Mark Joseph (Muskardin) hackingbeauty

🎯
Focusing
View GitHub Profile
@hackingbeauty
hackingbeauty / gist:1de476aa19ae23b496ccc18e40cd7c71
Created December 3, 2024 13:05
deployments/deployToken.js
const main = async() => {
const initialSupply = ethers.utils.parseEther("100000");
const [deployer] = await ethers.getSigners();
console.log(`Address deploying the contract --> ${deployer.address}`);
const tokenFactory = await ethers.getContractFactory("Token");
const contract = await tokenFactory.deploy(initialSupply);
console.log(`Token Contract address --> ${contract.address}`);
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-etherscan");
require('dotenv').config();
const privateKey = process.env.PRIVATE_KEY;
const endpoint = process.env.URL;
const etherscanKey = process.env.ETHERSCAN_KEY;
module.exports = {
@hackingbeauty
hackingbeauty / gist:e4ce25187d4e0a133fdd1a546f546318
Created December 3, 2024 12:38
Test cases for simple/truncated Non-standard ERC20
const { expect } = require("chai");
const { ethers } = require("hardhat");
describe("Token.sol", () => {
let contractFactory;
let contract;
let owner;
let alice;
let bob;
@hackingbeauty
hackingbeauty / gist:c207380735c03351113106263ddd8bf0
Created December 3, 2024 12:34
Simple/Truncated Non-Standard ERC20
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.8.0 <0.9.0;
/**
* @title Token - a simple example (non - ERC-20 compliant) token contract.
*/
contract Token {
address private owner;
string public constant name = "MyToken";
const { expect } = require("chai");
const { loadFixture } = require("@nomicfoundation/hardhat-network-helpers");
const { ethers, network } = require("hardhat");
describe("TradingPairExchange contract", ()=> {
async function deployTradingPairExchangeFixture() {
await network.provider.send("hardhat_reset");
/* AAVE/DAI, 1 AAVE = $56 USD, 1 DAI = $1 USD */
const amountADesired = ethers.utils.parseUnits('1', 18); //AAVE
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
contract ERC20 is Context, IERC20, IERC20Metadata {
let storage = []
let callbackFNConstructor = (index) => (error, contractData) => {
storage[index] = contractData
}
for(var i = 0; i < 6; i++) {
web3.eth.getStorageAt(contract.address, i, callbackFNConstructor(i))
}
pragma solidity ^0.6.6;
import './GateKeeperOne.sol';
import "https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol";
contract GateKeeperOneAttack {
using SafeMath for uint256;
bytes8 key;
GatekeeperOne gateKeeper;
pragma solidity ^0.6.10;
import './Reentrance.sol';
contract EthernautReentrancyAttack {
Reentrance target;
uint public amount = 1 ether; //withdrawal amount each time
constructor(address payable _targetAddr) public payable {
target = Reentrance(_targetAddr);
pragma solidity ^0.6.10;
import "https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol";
contract Reentrance {
using SafeMath for uint256;
mapping(address => uint) public balances;
function donate(address _to) public payable {