-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* burnable pausable * capped * tokens * removed old tests
- Loading branch information
1 parent
3fc9285
commit 5629eb1
Showing
9 changed files
with
616 additions
and
27 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,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; | ||
|
||
contract ERC20GovBurnable is ERC20Upgradeable, ERC20BurnableUpgradeable { | ||
struct InitMint { | ||
address user; | ||
uint256 amount; | ||
} | ||
|
||
function __ERC20GovBurnable_init( | ||
string calldata name, | ||
string calldata symbol, | ||
InitMint[] calldata distributions | ||
) external initializer { | ||
__ERC20_init(name, symbol); | ||
|
||
for (uint256 i = 0; i < distributions.length; i++) { | ||
_mint(distributions[i].user, distributions[i].amount); | ||
} | ||
} | ||
} |
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,49 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20CappedUpgradeable.sol"; | ||
|
||
contract ERC20GovCapped is | ||
ERC20Upgradeable, | ||
OwnableUpgradeable, | ||
ERC20BurnableUpgradeable, | ||
ERC20CappedUpgradeable | ||
{ | ||
struct InitMint { | ||
address user; | ||
uint256 amount; | ||
} | ||
|
||
function __ERC20GovCapped_init( | ||
string calldata name, | ||
string calldata symbol, | ||
InitMint[] calldata distributions, | ||
address newOwner, | ||
uint256 cap_ | ||
) external initializer { | ||
__ERC20_init(name, symbol); | ||
|
||
__Ownable_init(); | ||
transferOwnership(newOwner); | ||
|
||
__ERC20Capped_init(cap_); | ||
|
||
for (uint256 i = 0; i < distributions.length; i++) { | ||
_mint(distributions[i].user, distributions[i].amount); | ||
} | ||
} | ||
|
||
function mint(address account, uint256 amount) external onlyOwner { | ||
_mint(account, amount); | ||
} | ||
|
||
function _mint( | ||
address account, | ||
uint256 amount | ||
) internal virtual override(ERC20Upgradeable, ERC20CappedUpgradeable) { | ||
ERC20CappedUpgradeable._mint(account, amount); | ||
} | ||
} |
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,67 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20CappedUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol"; | ||
|
||
contract ERC20GovCappedPausable is | ||
ERC20Upgradeable, | ||
OwnableUpgradeable, | ||
ERC20BurnableUpgradeable, | ||
ERC20CappedUpgradeable, | ||
ERC20PausableUpgradeable | ||
{ | ||
struct InitMint { | ||
address user; | ||
uint256 amount; | ||
} | ||
|
||
function __ERC20GovCappedPausable_init( | ||
string calldata name, | ||
string calldata symbol, | ||
InitMint[] calldata distributions, | ||
address newOwner, | ||
uint256 cap_ | ||
) external initializer { | ||
__ERC20_init(name, symbol); | ||
|
||
__Ownable_init(); | ||
transferOwnership(newOwner); | ||
|
||
__ERC20Capped_init(cap_); | ||
|
||
for (uint256 i = 0; i < distributions.length; i++) { | ||
_mint(distributions[i].user, distributions[i].amount); | ||
} | ||
} | ||
|
||
function mint(address account, uint256 amount) external onlyOwner { | ||
_mint(account, amount); | ||
} | ||
|
||
function pause() external onlyOwner { | ||
_pause(); | ||
} | ||
|
||
function unpause() external onlyOwner { | ||
_unpause(); | ||
} | ||
|
||
function _mint( | ||
address account, | ||
uint256 amount | ||
) internal virtual override(ERC20Upgradeable, ERC20CappedUpgradeable) { | ||
ERC20CappedUpgradeable._mint(account, amount); | ||
} | ||
|
||
function _beforeTokenTransfer( | ||
address from, | ||
address to, | ||
uint256 amount | ||
) internal override(ERC20Upgradeable, ERC20PausableUpgradeable) { | ||
ERC20PausableUpgradeable._beforeTokenTransfer(from, to, amount); | ||
} | ||
} |
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
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,33 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
|
||
contract ERC20GovMintable is ERC20Upgradeable, ERC20BurnableUpgradeable, OwnableUpgradeable { | ||
struct InitMint { | ||
address user; | ||
uint256 amount; | ||
} | ||
|
||
function __ERC20GovMintable_init( | ||
string calldata name, | ||
string calldata symbol, | ||
InitMint[] calldata distributions, | ||
address newOwner | ||
) external initializer { | ||
__ERC20_init(name, symbol); | ||
|
||
__Ownable_init(); | ||
transferOwnership(newOwner); | ||
|
||
for (uint256 i = 0; i < distributions.length; i++) { | ||
_mint(distributions[i].user, distributions[i].amount); | ||
} | ||
} | ||
|
||
function mint(address account, uint256 amount) external onlyOwner { | ||
_mint(account, amount); | ||
} | ||
} |
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,55 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol"; | ||
|
||
contract ERC20GovMintablePausable is | ||
ERC20Upgradeable, | ||
ERC20BurnableUpgradeable, | ||
OwnableUpgradeable, | ||
ERC20PausableUpgradeable | ||
{ | ||
struct InitMint { | ||
address user; | ||
uint256 amount; | ||
} | ||
|
||
function __ERC20GovMintablePausable_init( | ||
string calldata name, | ||
string calldata symbol, | ||
InitMint[] calldata distributions, | ||
address newOwner | ||
) external initializer { | ||
__ERC20_init(name, symbol); | ||
|
||
__Ownable_init(); | ||
transferOwnership(newOwner); | ||
|
||
for (uint256 i = 0; i < distributions.length; i++) { | ||
_mint(distributions[i].user, distributions[i].amount); | ||
} | ||
} | ||
|
||
function mint(address account, uint256 amount) external onlyOwner { | ||
_mint(account, amount); | ||
} | ||
|
||
function pause() external onlyOwner { | ||
_pause(); | ||
} | ||
|
||
function unpause() external onlyOwner { | ||
_unpause(); | ||
} | ||
|
||
function _beforeTokenTransfer( | ||
address from, | ||
address to, | ||
uint256 amount | ||
) internal override(ERC20Upgradeable, ERC20PausableUpgradeable) { | ||
ERC20PausableUpgradeable._beforeTokenTransfer(from, to, amount); | ||
} | ||
} |
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,44 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol"; | ||
|
||
contract ERC20GovPausable is ERC20Upgradeable, OwnableUpgradeable, ERC20PausableUpgradeable { | ||
struct InitMint { | ||
address user; | ||
uint256 amount; | ||
} | ||
|
||
function __ERC20GovPausable_init( | ||
string calldata name, | ||
string calldata symbol, | ||
InitMint[] calldata distributions, | ||
address newOwner | ||
) external initializer { | ||
__Ownable_init(); | ||
transferOwnership(newOwner); | ||
__ERC20_init(name, symbol); | ||
|
||
for (uint256 i = 0; i < distributions.length; i++) { | ||
_mint(distributions[i].user, distributions[i].amount); | ||
} | ||
} | ||
|
||
function pause() external onlyOwner { | ||
_pause(); | ||
} | ||
|
||
function unpause() external onlyOwner { | ||
_unpause(); | ||
} | ||
|
||
function _beforeTokenTransfer( | ||
address from, | ||
address to, | ||
uint256 amount | ||
) internal override(ERC20Upgradeable, ERC20PausableUpgradeable) { | ||
ERC20PausableUpgradeable._beforeTokenTransfer(from, to, amount); | ||
} | ||
} |
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
Oops, something went wrong.