Skip to content

Commit 78e15e4

Browse files
authored
chore(protocol-contracts): add cap in mock ERC20 mint in registry project (#1641)
1 parent acacb05 commit 78e15e4

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

protocol-contracts/confidential-token-wrappers-registry/contracts/mocks/ERC20Mock.sol

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ pragma solidity ^0.8.20;
44
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
55

66
contract ERC20Mock is ERC20 {
7+
error MintAmountExceedsMax(uint256 amount, uint256 maxAmount);
8+
9+
uint256 public constant MAX_MINT_AMOUNT = 1_000_000 * 10 ** 18;
10+
711
constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {}
812

913
function mint(address to, uint256 amount) external {
14+
if (amount > MAX_MINT_AMOUNT) {
15+
revert MintAmountExceedsMax(amount, MAX_MINT_AMOUNT);
16+
}
1017
_mint(to, amount);
1118
}
1219
}
13-

protocol-contracts/confidential-token-wrappers-registry/tasks/mocks/deployMocks.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,3 @@ task('task:deployERC20Mock')
5151

5252
console.log('✅ ERC20Mock contract deployed\n');
5353
});
54-

protocol-contracts/confidential-token-wrappers-registry/tasks/mocks/verify.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { task, types } from 'hardhat/config';
22

33
// Verify a mock ERC20 contract
44
// Example usage:
5-
// npx hardhat task:verifyMockERC20 --contract-address 0x1234567890123456789012345678901234567890 --network testnet
5+
// npx hardhat task:verifyMockERC20 --contract-address 0x1234567890123456789012345678901234567890 --name "Mock Token" --symbol "MTK" --network testnet
66
task('task:verifyMockERC20')
77
.addParam('contractAddress', 'The address of the mock ERC20 contract to verify', '', types.string)
88
.addParam('name', 'The name of the mock ERC20 contract to verify', '', types.string)
@@ -15,7 +15,5 @@ task('task:verifyMockERC20')
1515
address: contractAddress,
1616
constructorArguments: [name, symbol],
1717
});
18-
console.log(
19-
`Mock ERC20 contract verification complete\n`,
20-
);
18+
console.log(`Mock ERC20 contract verification complete\n`);
2119
});

0 commit comments

Comments
 (0)