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
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}`); |
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("@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 = { |
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
const { expect } = require("chai"); | |
const { ethers } = require("hardhat"); | |
describe("Token.sol", () => { | |
let contractFactory; | |
let contract; | |
let owner; | |
let alice; | |
let bob; |
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: 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"; |
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
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 |
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: 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 { |
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
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)) | |
} |
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
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; |
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
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); |
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
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 { |
NewerOlder