This repository has been archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d5bfa3
commit 4f89994
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pragma solidity 0.6.12; | ||
|
||
import "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol"; | ||
|
||
|
||
contract ERC20Custom is ERC20PresetMinterPauser { | ||
|
||
/** | ||
* @dev Allows overriding the name, symbol & decimal of the base ERC20 contract | ||
*/ | ||
constructor(string memory name, string memory symbol, uint8 decimals) public ERC20PresetMinterPauser(name, symbol) { | ||
_setupDecimals(decimals); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Copyright 2020 ChainSafe Systems | ||
* SPDX-License-Identifier: LGPL-3.0-only | ||
*/ | ||
|
||
const TruffleAssert = require('truffle-assertions'); | ||
const Ethers = require('ethers'); | ||
const { it } = require('ethers/wordlists'); | ||
|
||
const ERC20CustomContract = artifacts.require("ERC20Custom"); | ||
|
||
contract('ERC20Custom - [ERC20]', async () => { | ||
|
||
it('[sanity] contract should be deployed successfully', async () => { | ||
TruffleAssert.passes(await ERC20CustomContract.new("token", "TOK", 18)); | ||
}); | ||
|
||
it('Decimals can be modified', async () => { | ||
const ERC20Instance = await ERC20CustomContract.new("token", "TOK", 10); | ||
const decimals = await ERC20Instance.decimals.call(); | ||
assert.isTrue(decimals == 10, "Contract wasn't successfully marked burnable"); | ||
}); | ||
}); |