-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
76 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "lib/openzeppelin-contracts"] | ||
path = lib/openzeppelin-contracts | ||
url = https://github.com/OpenZeppelin/openzeppelin-contracts |
This file contains 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
Submodule openzeppelin-contracts
added at
69c8de
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import {Script, console} from "forge-std/Script.sol"; | ||
import {TestnetERC20Token} from "../src/TestnetERC20Token.sol"; | ||
|
||
contract ERC20Script is Script { | ||
TestnetERC20Token public dai; | ||
TestnetERC20Token public wbtc; | ||
|
||
function setUp() public {} | ||
|
||
function run() public { | ||
vm.startBroadcast(); | ||
|
||
dai = new TestnetERC20Token("DAI", "DAI", 18); | ||
dai.mint(msg.sender, 10_000_000 * 10**18); | ||
console.log("DAI address", address(dai)); | ||
console.log("DAI minted", dai.balanceOf(msg.sender)); | ||
|
||
wbtc = new TestnetERC20Token("WBTC", "WBTC", 18); | ||
wbtc.mint(msg.sender, 10_000_000 * 10**18); | ||
console.log("WBTC address", address(wbtc)); | ||
console.log("WBTC minted", wbtc.balanceOf(msg.sender)); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
contract Counter { | ||
uint256 public number; | ||
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
function setNumber(uint256 newNumber) public { | ||
contract Counter is Ownable { | ||
uint256 private number; | ||
|
||
constructor() Ownable(msg.sender) {} | ||
|
||
function getNumber() public view returns (uint256) { | ||
return number; | ||
} | ||
|
||
function setNumber(uint256 newNumber) public onlyOwner { | ||
number = newNumber; | ||
} | ||
|
||
function increment() public { | ||
function increment() public onlyOwner { | ||
number++; | ||
} | ||
|
||
receive() external payable {} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract TestnetERC20Token is ERC20 { | ||
// add this to be excluded from coverage report | ||
function test() internal virtual {} | ||
|
||
uint8 private _decimals; | ||
|
||
constructor(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_) { | ||
_decimals = decimals_; | ||
} | ||
|
||
function mint(address _to, uint256 _amount) public returns (bool) { | ||
_mint(_to, _amount); | ||
return true; | ||
} | ||
|
||
function decimals() public view override returns (uint8) { | ||
return _decimals; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.