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

Protocol token #4

Merged
merged 9 commits into from
Oct 18, 2024
Merged
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
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ PRIVATE_KEY=
# RPC_URL=http://127.0.0.1:8545
RPC_URL=https://gateway.tenderly.co/public/polygon

MAINNET_RPC_URL=https://eth-mainnet.nodereal.io/v1/1659dfb40aa24bbb8153a677b98064d7

ETHERSCAN_API_KEY=

OWNER=
Expand Down
46 changes: 46 additions & 0 deletions src/governance/DAM.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.24;

import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessControl.sol";

import {ERC20Votes, ERC20, ERC20Permit} from "openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Votes.sol";

import {ERC20} from "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";

contract DAM is AccessControl, ERC20Votes {
uint256 private constant supply = 1_000_000_000e18;

bytes32 public constant MINTER = keccak256(abi.encode("dam.minter"));

constructor(
address admin_,
string memory name_,
string memory symbol_
) ERC20(name_, symbol_) ERC20Permit(name_) {
_grantRole(DEFAULT_ADMIN_ROLE, admin_);

_mint(admin_, supply);
}

/// @notice Increase token total supply
/// @param account Address to increment the token balance
/// @param amount Quantity of token added
function mint(address account, uint256 amount) external onlyRole(MINTER) {
_mint(account, amount);
}

/// @notice Decrease token total supply
/// @param amount Quantity of token deducted
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}

/// @notice Decrease token total supply
/// @param account Address to decrement the token balance
/// @param amount Quantity of token deducted
function burnFrom(address account, uint256 amount) public virtual {
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
}
1 change: 1 addition & 0 deletions test/morpho/MorphoUnderlyingAdapter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ contract MorphoUnderlyingAdapterTest is Test {

function testRecover(uint256 _amount, address _reciever) external {
vm.assume(_reciever != address(0));
vm.assume(_reciever != address(adapter));

ERC20 testToken = new ERC20("Test Token", "TTT");
deal(address(testToken), address(adapter), _amount);
Expand Down
Loading