diff --git a/solution-2.md b/solution-2.md new file mode 100644 index 00000000..68573535 --- /dev/null +++ b/solution-2.md @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.9; + +import "@openzeppelin/contracts@4.8.2/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts@4.8.2/token/ERC20/extensions/ERC20Snapshot.sol"; +import "@openzeppelin/contracts@4.8.2/access/Ownable.sol"; +import "@openzeppelin/contracts@4.8.2/token/ERC20/extensions/draft-ERC20Permit.sol"; +import "@openzeppelin/contracts@4.8.2/token/ERC20/extensions/ERC20FlashMint.sol"; + +contract Shivrajput is ERC20, ERC20Snapshot, Ownable, ERC20Permit, ERC20FlashMint { + constructor() ERC20("Shivrajput", "SHIV") ERC20Permit("Shivrajput") { + _mint(msg.sender, 10000 * 10 ** decimals()); + } + + function snapshot() public onlyOwner { + _snapshot(); + } + + function mint(address to, uint256 amount) public onlyOwner { + _mint(to, amount); + } + + // The following functions are overrides required by Solidity. + + function _beforeTokenTransfer(address from, address to, uint256 amount) + internal + override(ERC20, ERC20Snapshot) + { + super._beforeTokenTransfer(from, to, amount); + } +}