Skip to content

Instantly share code, notes, and snippets.

@CJ42
Created March 11, 2024 15:28
Show Gist options
  • Save CJ42/be6a4cdec24a39cf17553a926b47206a to your computer and use it in GitHub Desktop.
Save CJ42/be6a4cdec24a39cf17553a926b47206a to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract EcoCoin is ERC20, ERC20Burnable, Ownable {
constructor(
address initialOwner
) ERC20("EcoCoin", "ECN") Ownable(initialOwner) {
_mint(msg.sender, 10000 * 10 ** decimals());
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}
// --------
// modules
import {
LSP7DigitalAsset
} from "@lukso/lsp7-contracts/contracts/LSP7DigitalAsset.sol";
import {
LSP7Burnable
} from "@lukso/lsp7-contracts/contracts/extensions/LSP7Burnable.sol";
// constants
import {
_LSP4_TOKEN_TYPE_TOKEN
} from "@lukso/lsp4-contracts/contracts/LSP4Constants.sol";
contract MyTokenLSP7 is LSP7DigitalAsset, LSP7Burnable {
constructor(
address initialOwner
)
LSP7DigitalAsset(
"MyToken",
"MTK",
initialOwner,
_LSP4_TOKEN_TYPE_TOKEN,
false
)
{
_mint(msg.sender, 10_000 * 10 ** decimals(), true, "0x");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment