Skip to content

Commit

Permalink
Initial wREACT version
Browse files Browse the repository at this point in the history
  • Loading branch information
daniil-parsiq committed Nov 6, 2024
1 parent 41ed060 commit 78a78e5
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Compiler files
cache/
out/
src/artifacts

# Ignores development broadcast logs
!/broadcast
Expand Down
6 changes: 6 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/
erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/
forge-std/=lib/forge-std/src/
halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/
openzeppelin-contracts/=lib/openzeppelin-contracts/
19 changes: 0 additions & 19 deletions script/Counter.s.sol

This file was deleted.

37 changes: 37 additions & 0 deletions src/AuthorizedMinter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import "@openzeppelin/contracts/utils/Context.sol";


abstract contract AuthorizedMinter is Context {
mapping (address => bool) public authorizedMinters;

event MinterAuthorized(address minter);
event MinterDeAuthorized(address minter);

error MinterUnauthorized(address);

modifier onlyAuthorizedMinter() {
__checkAuthorizedMinter();
_;
}

function __checkAuthorizedMinter() internal view virtual {
if (!authorizedMinters[_msgSender()] == true) {
revert MinterUnauthorized(_msgSender());
}
}

function _authorizeMinter(address minter) internal {
authorizedMinters[minter] = true;

emit MinterAuthorized(minter);
}

function _deAuthorizeMinter(address minter) internal {
authorizedMinters[minter] = false;

emit MinterDeAuthorized(minter);
}
}
14 changes: 0 additions & 14 deletions src/Counter.sol

This file was deleted.

29 changes: 29 additions & 0 deletions src/WrappedReact.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./AuthorizedMinter.sol";

contract WrappedReact is ERC20, Ownable, AuthorizedMinter {
constructor()
ERC20("Wrapped REACT", "wREACT")
Ownable(msg.sender)
{}

function authorizeMinter(address minter) public onlyOwner {
_authorizeMinter(minter);
}

function deAuthorizeMinter(address minter) public onlyOwner {
_deAuthorizeMinter(minter);
}

function mint(address to, uint256 amount) public onlyAuthorizedMinter {
_mint(to, amount);
}

function burn(address from, uint amount) public onlyAuthorizedMinter {
_burn(from, amount);
}
}
24 changes: 0 additions & 24 deletions test/Counter.t.sol

This file was deleted.

0 comments on commit 78a78e5

Please sign in to comment.