🛠️ Task

참고 자료

(Alchemy + dotenv + Hardhat)

ChainShot

Github Repository

https://github.com/decentra1ized/Advanced-Solidity

Hardhat 이용해서 기본적인 ERC20 컨트랙트 배포(erc20)

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract Kcr is ERC20 {
    uint constant _initial_supply = 100 * (10**18);
    constructor() ERC20("Kcr", "KCR") public {
        _mint(msg.sender, _initial_supply);
    }
}

0x17A7fbc4f3eB7F516aAB9C710026ca41A2d6F0Cc

0x17A7fbc4f3eB7F516aAB9C710026ca41A2d6F0Cc

스크린샷 2022-03-29 오후 10.54.03.png

Hardhat 이용해서 Custom Contract 배포

Advanced-Solidity/NewKcr.sol at main · decentra1ized/Advanced-Solidity

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract NewKcr is ERC20, Pausable, Ownable {
    uint constant _initial_supply = 100 * (10**18);
    constructor() ERC20("NewKcr", "KCR") public {
        _mint(msg.sender, _initial_supply);
    }

    function pause() public onlyOwner {
        _pause();
    }

    function unpause() public onlyOwner {
        _unpause();
    }

    function _beforeTokenTransfer(address from, address to, uint256 amount)
        internal
        whenNotPaused
        override
    {
        super._beforeTokenTransfer(from, to, amount);
    }
}