Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Pull request(made some changes) #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions erc20-generator-master/erc20-generator-master/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 @vittominacori

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
96 changes: 96 additions & 0 deletions erc20-generator-master/erc20-generator-master/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# ERC20 Token Generator

[![Build Status](https://travis-ci.org/vittominacori/erc20-generator.svg?branch=master)](https://travis-ci.org/vittominacori/erc20-generator)
[![Coverage Status](https://coveralls.io/repos/github/vittominacori/erc20-generator/badge.svg?branch=master)](https://coveralls.io/github/vittominacori/erc20-generator?branch=master)

A simple Smart Contract for a Standard, Capped, Mintable, Burnable, Payable ERC20 Token.

Token has a Role Based Access Control so you can add the "minter" permission to users or Smart Contracts.

Token also has [ERC1363](https://github.com/ethereum/EIPs/issues/1363) Behaviours to work like a Payable Token.


DApp here [https://vittominacori.github.io/erc20-generator](https://vittominacori.github.io/erc20-generator)

DApp source here [https://github.com/vittominacori/erc20-generator/tree/dapp](https://github.com/vittominacori/erc20-generator/tree/dapp)

## Installation

Install truffle.

```bash
npm install -g truffle // Version 4.1.14+ required.
```

## Install dependencies

```bash
npm install
```

## Linter

Use Solium

```bash
npm run lint:sol
```

Use ESLint

```bash
npm run lint:js
```

#### Note

IMPORTANT: Before commit run the lint and fix command:

```bash
npm run lint:fix
```

## Compile and test the contracts.

Open the Truffle console

```bash
truffle develop
```

Compile

```bash
compile
```

Test

```bash
test
```

## Optional

Install the [truffle-flattener](https://github.com/alcuadrado/truffle-flattener)

```bash
npm install -g truffle-flattener
```

Usage

```bash
truffle-flattener contracts/BaseToken.sol > dist/BaseToken.dist.sol
```

## Token verification on Etherscan

Use the dist smart contracts [dist/BaseToken.dist.sol](https://github.com/vittominacori/erc20-generator/blob/master/dist/BaseToken.dist.sol)

Solc version is 0.4.24


## License

Code released under the [MIT License](https://github.com/vittominacori/erc20-generator/blob/master/LICENSE).
72 changes: 72 additions & 0 deletions erc20-generator-master/erc20-generator-master/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name": "erc20-generator",
"version": "2.0.0",
"description": "A simple Smart Contract for a Standard, Capped, Mintable, Burnable, Payable ERC20 Token.",
"main": "truffle-config.js",
"directories": {
"test": "test"
},
"scripts": {
"dev": "lite-server",
"test": "scripts/test.sh",
"lint:js": "eslint .",
"lint:js:fix": "eslint . --fix",
"lint:sol": "solium -d .",
"lint:sol:fix": "solium -d . --fix",
"lint": "npm run lint:js && npm run lint:sol",
"lint:fix": "npm run lint:js:fix && npm run lint:sol:fix",
"flat:all": "truffle-flattener contracts/BaseToken.sol > dist/BaseToken.dist.sol",
"console": "truffle console",
"coverage": "scripts/coverage.sh"
},
"repository": {
"type": "git",
"url": "https://github.com/vittominacori/erc20-generator.git"
},
"homepage": "https://github.com/vittominacori/erc20-generator/",
"bugs": {
"url": "https://github.com/vittominacori/erc20-generator/issues"
},
"author": "@vittominacori",
"authors": [
{
"name": "Vittorio Minacori",
"url": "https://github.com/vittominacori"
}
],
"license": "MIT",
"devDependencies": {
"chai": "^4.2.0",
"chai-bignumber": "^3.0.0",
"coveralls": "^3.0.2",
"dotenv": "^6.1.0",
"eslint": "^5.9.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"ethereumjs-abi": "^0.6.5",
"ethereumjs-util": "^6.0.0",
"ethereumjs-wallet": "^0.6.2",
"ethjs-abi": "^0.2.1",
"ganache-cli": "6.2.3",
"lite-server": "^2.4.0",
"log4js": "^3.0.6",
"prompt-sync": "^4.1.6",
"solidity-coverage": "^0.5.11",
"solium": "^1.1.8",
"truffle": "^4.1.14",
"truffle-contract": "^3.0.6",
"truffle-hdwallet-provider": "^0.0.6",
"truffle-wallet-provider": "^0.0.5",
"web3": "0.20.6",
"web3-eth-abi": "^1.0.0-beta.36",
"web3-utils": "^1.0.0-beta.36"
},
"dependencies": {
"erc-payable-token": "2.0.0",
"eth-token-recover": "2.0.0",
"openzeppelin-solidity": "2.0.0"
}
}
5 changes: 5 additions & 0 deletions erc20-generator-master/erc20-generator-master/bs-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"server": {
"baseDir": ["./src", "./build/contracts"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pragma solidity ^0.4.24;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Capped.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";
import "erc-payable-token/contracts/token/ERC1363/ERC1363.sol";
import "eth-token-recover/contracts/TokenRecover.sol";

/**
* @title BaseToken
* @author Vittorio Minacori (https://github.com/vittominacori)
* @dev Implementation of a BaseToken
*/
contract BaseToken is ERC20Detailed, ERC20Capped, ERC20Burnable, ERC1363, TokenRecover { // solium-disable-line max-len

string public builtOn = "https://vittominacori.github.io/erc20-generator";

constructor(
string name,
string symbol,
uint8 decimals,
uint256 cap,
uint256 initialBalance
)
ERC20Detailed(name, symbol, decimals)
ERC20Capped(cap)
public
{
if (initialBalance > 0) {
_mint(owner(), initialBalance);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
pragma solidity ^0.4.24;

import "erc-payable-token/contracts/token/ERC1363/IERC1363Receiver.sol";


// mock class using IERC1363Receiver
contract ERC1363ReceiverMock is IERC1363Receiver {
bytes4 private _retval;
bool private _reverts;

event Received(
address operator,
address from,
uint256 value,
bytes data,
uint256 gas
);

constructor(bytes4 retval, bool reverts) public {
_retval = retval;
_reverts = reverts;
}

function onTransferReceived(
address operator,
address from,
uint256 value,
bytes data
)
external
returns (bytes4)
{
require(!_reverts);
emit Received(
operator,
from,
value,
data,
gasleft() // msg.gas was deprecated in solidityv0.4.21
);
return _retval;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
pragma solidity ^0.4.24;

import "erc-payable-token/contracts/token/ERC1363/IERC1363Spender.sol";


// mock class using IERC1363Spender
contract ERC1363SpenderMock is IERC1363Spender {
bytes4 private _retval;
bool private _reverts;

event Approved(
address owner,
uint256 value,
bytes data,
uint256 gas
);

constructor(bytes4 retval, bool reverts) public {
_retval = retval;
_reverts = reverts;
}

function onApprovalReceived(
address owner,
uint256 value,
bytes data
)
external
returns (bytes4)
{
require(!_reverts);
emit Approved(
owner,
value,
data,
gasleft() // msg.gas was deprecated in solidityv0.4.21
);
return _retval;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pragma solidity ^0.4.24;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";


// mock class using ERC20
contract ERC20Mock is ERC20 {

constructor(address initialAccount, uint256 initialBalance) public {
_mint(initialAccount, initialBalance);
}
}
Loading