Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
add detailed erc20
Browse files Browse the repository at this point in the history
  • Loading branch information
GregTheGreek committed Jan 27, 2021
1 parent 1d5bfa3 commit 4f89994
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
14 changes: 14 additions & 0 deletions contracts/ERC20Custom.sol
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);
}
}
23 changes: 23 additions & 0 deletions test/tokens/erc20/erc20Custom.js
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");
});
});

0 comments on commit 4f89994

Please sign in to comment.