Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Deployment Script for Users for better User experience #57

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {ERC404} from "../ERC404.sol";
import {ERC404} from "./ERC404.sol";

contract ERC404Example is Ownable, ERC404 {
constructor(
Expand Down
72 changes: 30 additions & 42 deletions contracts/mocks/WETH.sol
Original file line number Diff line number Diff line change
@@ -1,81 +1,69 @@
/**
*Submitted for verification at Etherscan.io on 2017-12-12
*/

// Copyright (C) 2015, 2016, 2017 Dapphub

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.4.18;
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.18;

contract WETH {
string public name = "Wrapped Ether";
string public symbol = "WETH";
uint8 public decimals = 18;

event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
event Deposit(address indexed dst, uint wad);
event Withdrawal(address indexed src, uint wad);
event Approval(address indexed src, address indexed guy, uint256 wad);
event Transfer(address indexed src, address indexed dst, uint256 wad);
event Deposit(address indexed dst, uint256 wad);
event Withdrawal(address indexed src, uint256 wad);

mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;

function() public payable {
receive() external payable {
deposit();
}

function deposit() public payable {
balanceOf[msg.sender] += msg.value;
Deposit(msg.sender, msg.value);
emit Deposit(msg.sender, msg.value);
}
function withdraw(uint wad) public {
require(balanceOf[msg.sender] >= wad);

function withdraw(uint256 wad) public {
require(balanceOf[msg.sender] >= wad, "WETH: insufficient balance");
balanceOf[msg.sender] -= wad;
msg.sender.transfer(wad);
Withdrawal(msg.sender, wad);
(bool success, ) = msg.sender.call{value: wad}("");
require(success, "WETH: ETH transfer failed");
emit Withdrawal(msg.sender, wad);
}

function totalSupply() public view returns (uint) {
return this.balance;
function totalSupply() public view returns (uint256) {
return address(this).balance;
}

function approve(address guy, uint wad) public returns (bool) {
function approve(address guy, uint256 wad) public returns (bool) {
allowance[msg.sender][guy] = wad;
Approval(msg.sender, guy, wad);
emit Approval(msg.sender, guy, wad);
return true;
}

function transfer(address dst, uint wad) public returns (bool) {
function transfer(address dst, uint256 wad) public returns (bool) {
return transferFrom(msg.sender, dst, wad);
}

function transferFrom(
address src,
address dst,
uint wad
uint256 wad
) public returns (bool) {
require(balanceOf[src] >= wad);
require(balanceOf[src] >= wad, "WETH: insufficient balance");

if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
require(allowance[src][msg.sender] >= wad);
if (src != msg.sender && allowance[src][msg.sender] != type(uint256).max) {
require(
allowance[src][msg.sender] >= wad,
"WETH: insufficient allowance"
);
allowance[src][msg.sender] -= wad;
}

balanceOf[src] -= wad;
balanceOf[dst] += wad;

Transfer(src, dst, wad);
emit Transfer(src, dst, wad);

return true;
}
Expand Down
35 changes: 22 additions & 13 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
import "dotenv/config"
import { HardhatUserConfig } from "hardhat/config"
import "@nomicfoundation/hardhat-toolbox"
import "hardhat-gas-reporter"
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-ethers";
import "hardhat-gas-reporter";
import "dotenv/config";

const config: HardhatUserConfig = {
solidity: { compilers: [{ version: "0.8.20" }, { version: "0.4.18" }] },
gasReporter: {
currency: "USD",
gasPrice: 21,
enabled: true,
},
solidity: "0.8.20",
networks: {
hardhat: {
chainId: 31337,
},
sepolia: {
url: `https://eth-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`,
accounts: [process.env.SEPOLIA_PRIVATE_KEY_1],
accounts: [process.env.SEPOLIA_PRIVATE_KEY_1 || ""],
chainId: 11155111,
},
},
}
gasReporter: {
enabled: true,
currency: "USD",
gasPrice: 21,
outputFile: "gas-report.txt",
noColors: true,
},
mocha: {
timeout: 20000,
},
};

export default config
export default config;
Loading