Skip to content

Instantly share code, notes, and snippets.

View hackingbeauty's full-sized avatar
💯

Mark Muskardin hackingbeauty

💯
View GitHub Profile
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 {
pragma solidity ^0.6.10;
import './DAOWallet.sol';
contract ReentrancyAttack {
DAOWallet public daoWallet;
constructor(address _daoWalletAddress) public {
daoWallet = DAOWallet(_daoWalletAddress);
}
@hackingbeauty
hackingbeauty / gist:8b673e4e0d0df30c079d7794a45ed7d5
Created September 14, 2020 21:16
DAOWallet.sol (SmartContractSecurity.com)
pragma solidity ^0.6.10;
contract DAOWallet {
mapping(address => uint) public balances;
bool internal locked;
function deposit() public payable {
balances[msg.sender] += msg.value;
}

Keybase proof

I hereby claim:

  • I am hackingbeauty on github.
  • I am markmuskardin (https://keybase.io/markmuskardin) on keybase.
  • I have a public key ASDfxFH28621ppjKGpS9To4RuKxc_E4w4wXgjQXN0FADjgo

To claim this, I am signing this object:

{
"rules": {
"users": {
".write": "auth != null",
"$user_id" : {
".read": true,
".write": "$user_id === auth.uid"
}
},
"publicRecordings": {