Add ERC20 and ERC777 fixed supply presets #2377 (#2399)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
Ashwin Yardi
2020-12-02 23:21:33 +05:30
committed by GitHub
parent 5748034cd3
commit 883116e4af
6 changed files with 153 additions and 0 deletions

View File

@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
import "../token/ERC20/ERC20Burnable.sol";
/**
* @dev {ERC20} token, including:
*
* - Preminted initial supply
* - Ability for holders to burn (destroy) their tokens
* - No access control mechanism (for minting/pausing) and hence no governance
*
* This contract uses {ERC20Burnable} to include burn capabilities - head to
* its documentation for details.
*/
contract ERC20PresetFixedSupply is ERC20Burnable {
/**
* @dev Mints `initialSupply` amount of token and transfers them to `owner`.
*
* See {ERC20-constructor}.
*/
constructor(
string memory name,
string memory symbol,
uint256 initialSupply,
address owner
) public ERC20(name, symbol) {
_mint(owner, initialSupply);
}
}

View File

@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
import "../token/ERC777/ERC777.sol";
/**
* @dev {ERC777} token, including:
*
* - Preminted initial supply
* - No access control mechanism (for minting/pausing) and hence no governance
*/
contract ERC777PresetFixedSupply is ERC777 {
/**
* @dev Mints `initialSupply` amount of token and transfers them to `owner`.
*
* See {ERC777-constructor}.
*/
constructor(
string memory name,
string memory symbol,
address[] memory defaultOperators,
uint256 initialSupply,
address owner
) public ERC777(name, symbol, defaultOperators) {
_mint(owner, initialSupply, "", "");
}
}

View File

@ -16,3 +16,7 @@ TIP: Intermediate and advanced users can use these as starting points when writi
{{ERC721PresetMinterPauserAutoId}}
{{ERC1155PresetMinterPauser}}
{{ERC20PresetFixedSupply}}
{{ERC777PresetFixedSupply}}