Skip to content

Commit

Permalink
Merge pull request #69 from oceanprotocol/feature/rename-datatoken
Browse files Browse the repository at this point in the history
fix template naming
  • Loading branch information
Ahmed authored May 28, 2020
2 parents 62d1f95 + 6c8df00 commit e617f71
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import '../fee/FeeManager.sol';
import './token/ERC20Pausable.sol';
import '../interfaces/IERC20Template.sol';
/**
* @title ERC20Template
* @title DataTokenTemplate
*
* @dev ERC20Template is a DataToken ERC20 compliant template
* @dev DataTokenTemplate is a DataToken ERC20 compliant template
* Used by the factory contract as a bytecode reference to deploy new DataTokens.
*/
contract ERC20Template is IERC20Template, ERC20Pausable {
contract DataTokenTemplate is IERC20Template, ERC20Pausable {
using SafeMath for uint256;

bool private initialized = false;
Expand All @@ -28,15 +28,15 @@ contract ERC20Template is IERC20Template, ERC20Pausable {
modifier onlyNotInitialized() {
require(
!initialized,
'ERC20Template: token instance already initialized'
'DataTokenTemplate: token instance already initialized'
);
_;
}

modifier onlyMinter() {
require(
msg.sender == _minter,
'ERC20Template: invalid minter'
'DataTokenTemplate: invalid minter'
);
_;
}
Expand Down Expand Up @@ -123,22 +123,22 @@ contract ERC20Template is IERC20Template, ERC20Pausable {
{
require(
minter != address(0),
'ERC20Template: Invalid minter, zero address'
'DataTokenTemplate: Invalid minter, zero address'
);

require(
feeManager != address(0),
'ERC20Template: Invalid feeManager, zero address'
'DataTokenTemplate: Invalid feeManager, zero address'
);

require(
_minter == address(0),
'ERC20Template: Invalid minter, access denied'
'DataTokenTemplate: Invalid minter, access denied'
);

require(
cap > 0,
'ERC20Template: Invalid cap value'
'DataTokenTemplate: Invalid cap value'
);

_decimals = 0;
Expand Down Expand Up @@ -172,11 +172,11 @@ contract ERC20Template is IERC20Template, ERC20Pausable {
{
require(
totalSupply().add(value) <= _cap,
'ERC20Template: cap exceeded'
'DataTokenTemplate: cap exceeded'
);
require(
msg.value >= serviceFeeManager.calculateFee(value, _cap),
'ERC20Template: invalid data token minting fee'
'DataTokenTemplate: invalid data token minting fee'
);
_mint(account, value);
address(serviceFeeManager).transfer(msg.value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* eslint-env mocha */
/* global artifacts, contract, it, beforeEach, web3, assert */
const Template = artifacts.require('ERC20Template')
const Template = artifacts.require('DataTokenTemplate')
const FeeManager = artifacts.require('FeeManager')
const Factory = artifacts.require('Factory')
const Token = artifacts.require('ERC20Template')
const Token = artifacts.require('DataTokenTemplate')
const testUtils = require('../helpers/utils')
const truffleAssert = require('truffle-assertions')
const BigNumber = require('bn.js')

contract('ERC20Template', async (accounts) => {
contract('DataTokenTemplate', async (accounts) => {
let cap,
name,
symbol,
Expand Down Expand Up @@ -54,7 +54,7 @@ contract('ERC20Template', async (accounts) => {
it('should fail to re-initialize the contracts', async () => {
truffleAssert.fails(token.initialize('NewName', 'NN', reciever, cap, blob, feeManager.address),
truffleAssert.ErrorType.REVERT,
'ERC20Template: token instance already initialized')
'DataTokenTemplate: token instance already initialized')
})

it('should check that the token is not paused', async () => {
Expand Down Expand Up @@ -88,7 +88,7 @@ contract('ERC20Template', async (accounts) => {
it('should not mint the tokens due to zero message value', async () => {
truffleAssert.fails(token.mint(reciever, 10, { from: minter }),
truffleAssert.ErrorType.REVERT,
'ERC20Template: invalid data token minting fee')
'DataTokenTemplate: invalid data token minting fee')
})

it('should not mint the tokens due to the cap limit', async () => {
Expand All @@ -98,7 +98,7 @@ contract('ERC20Template', async (accounts) => {

truffleAssert.fails(token.mint(reciever, tokenCap, { value: ethValue, from: minter }),
truffleAssert.ErrorType.REVERT,
'ERC20Template: cap exceeded')
'DataTokenTemplate: cap exceeded')
})

it('should not mint the tokens because of the paused contract', async () => {
Expand Down
6 changes: 3 additions & 3 deletions test/unit/Factory.Test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* global artifacts, contract, it, beforeEach */

const Factory = artifacts.require('Factory')
const Template = artifacts.require('ERC20Template')
const Template = artifacts.require('DataTokenTemplate')
const FeeManager = artifacts.require('FeeManager')
const truffleAssert = require('truffle-assertions')

Expand Down Expand Up @@ -51,14 +51,14 @@ contract('Factory test', async accounts => {
it('should fail on zero minter address initialization', async () => {
truffleAssert.fails(Template.new('Zero address minter contract', 'ZERO', zeroAddress, cap, blob, feeManager.address),
truffleAssert.ErrorType.REVERT,
'ERC20Template: Invalid minter, zero address'
'DataTokenTemplate: Invalid minter, zero address'
)
})

it('should fail on zero feeManager address initialization', async () => {
truffleAssert.fails(Template.new('Zero address minter contract', 'ZERO', minter, cap, blob, zeroAddress),
truffleAssert.ErrorType.REVERT,
'ERC20Template: Invalid minter, zero address'
'DataTokenTemplate: Invalid minter, zero address'
)
})
})

0 comments on commit e617f71

Please sign in to comment.