Skip to content

Commit

Permalink
update-solidity-version-pragma (#2)
Browse files Browse the repository at this point in the history
* chore: Update Solidity version to 0.8.4 in WrappedNativeToken contract

* feat: Update pragma solidity version and add ERC20Permit extension to WrappedNativeToken

* feat: Update solidity version to 0.8.4 and add Ownable contract for ERC20Token

* feature: Add support for token owner parameter in ERC20Token constructor.
  • Loading branch information
gnkz authored Oct 19, 2024
1 parent fe907d3 commit cd8cd00
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion script/Tokens.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract TokensScript is Script {
function run() public {
vm.startBroadcast();

new ERC20Token("Dummy USD", "dUSD", 1_000_000_000_000 ether, msg.sender);
new ERC20Token("Dummy USD", "dUSD", 1_000_000_000_000 ether, msg.sender, msg.sender);
new WrappedNativeToken("Wrapped ETH", "wETH");

vm.stopBroadcast();
Expand Down
8 changes: 5 additions & 3 deletions src/ERC20Token.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
pragma solidity ^0.8.4;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

contract ERC20Token is ERC20 {
constructor(string memory _name, string memory _symbol, uint256 _supply, address _supplyReceiver)
contract ERC20Token is ERC20, Ownable {
constructor(string memory _name, string memory _symbol, uint256 _supply, address _supplyReceiver, address _owner)
Ownable(_owner)
ERC20(_name, _symbol)
{
_mint(_supplyReceiver, _supply);
Expand Down
7 changes: 4 additions & 3 deletions src/WrappedNativeToken.sol
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
pragma solidity ^0.8.4;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";

contract WrappedNativeToken is ERC20 {
contract WrappedNativeToken is ERC20Permit {
event Deposit(address indexed _sender, uint256 _amount);
event Withdrawal(address indexed _sender, uint256 _amount);

error NotEnoughBalance();

constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {}
constructor(string memory _name, string memory _symbol) ERC20Permit(_name) ERC20(_name, _symbol) {}

function deposit() public payable {
_mint(msg.sender, msg.value);
Expand Down
2 changes: 1 addition & 1 deletion test/WrappedNativeToken.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
pragma solidity ^0.8.4;

import {Test} from "forge-std/Test.sol";

Expand Down

0 comments on commit cd8cd00

Please sign in to comment.