File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ pragma solidity 0.8.12 ;
2+ // Copyright BigchainDB GmbH and Ocean Protocol contributors
3+ // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
4+ // Code is Apache-2.0 and docs are CC-BY-4.0
5+
6+ import "@openzeppelin/contracts/token/ERC20/ERC20.sol " ;
7+ import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol " ;
8+
9+ /**
10+ * @dev Mock ERC20 token with configurable decimals and ERC20Permit support.
11+ * This is a test utility contract that implements ERC20Permit for testing permit functionality.
12+ */
13+ contract MockERC20Permit is ERC20 , ERC20Permit {
14+ uint8 private _decimals;
15+
16+ /**
17+ * @dev Sets the values for {name}, {symbol}, and {decimals}.
18+ * @param name_ Token name
19+ * @param symbol_ Token symbol
20+ * @param decimals_ Number of decimals
21+ */
22+ constructor (
23+ string memory name_ ,
24+ string memory symbol_ ,
25+ uint8 decimals_
26+ ) ERC20 (name_, symbol_) ERC20Permit (name_) {
27+ _decimals = decimals_;
28+ _mint (msg .sender , 10e25 );
29+ }
30+
31+ /**
32+ * @dev Returns the number of decimals used to get its user representation.
33+ */
34+ function decimals () public view virtual override returns (uint8 ) {
35+ return _decimals;
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments