Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
17 changes: 10 additions & 7 deletions evm-e2e/contracts/TestERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

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

contract TestERC20 is ERC20 {
// Define the supply of TestERC20: 1,000,000
uint256 constant initialSupply = 1000000 * (10 ** 18);

// Define the supply of TestERC20: 1,000,000
uint256 constant initialSupply = 1000000 * (10**18);
// Constructor will be called on contract creation
constructor() ERC20('TestERC20', 'FOO') {
_mint(msg.sender, initialSupply);
}

// Constructor will be called on contract creation
constructor() ERC20("TestERC20", "FOO") {
_mint(msg.sender, initialSupply);
}
function mint(address to, uint256 amount) public {
_mint(to, amount);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add access control to mint function

The mint function is public without any access restrictions, which could allow anyone to create unlimited tokens. Consider adding the OpenZeppelin Ownable contract and restricting minting to the contract owner.

+import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';

-contract TestERC20 is ERC20 {
+contract TestERC20 is ERC20, Ownable {
   // ... other code ...

-  function mint(address to, uint256 amount) public {
+  function mint(address to, uint256 amount) public onlyOwner {
     _mint(to, amount);
   }

Committable suggestion skipped: line range outside the PR's diff.

}
18 changes: 0 additions & 18 deletions x/evm/embeds/abi/ERC20Minter.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,24 +266,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "mint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
Expand Down
22 changes: 20 additions & 2 deletions x/evm/embeds/artifacts/contracts/TestERC20.sol/TestERC20.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading