Skip to content

Instantly share code, notes, and snippets.

View ChanJuiHuang's full-sized avatar

Chan Jui Huang ChanJuiHuang

View GitHub Profile
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.4.24;
contract BasicToken {
uint256 totalSupply_;
mapping(address => uint256) balances;
constructor(uint256 _initialSupply) public {
totalSupply_ = _initialSupply;
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/*
建立一個 Bank 銀行
在 web3 世界人人都可以當銀行家!我們想開張一間去中心化金融中心,簡易小而美的銀行
使用者可以將我們發行的 Staking Token (ERC20代幣)存入銀行
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/*
建立一個 Bank 銀行
在 web3 世界人人都可以當銀行家!我們想開張一間去中心化金融中心,簡易小而美的銀行
使用者可以將我們發行的 Staking Token (ERC20代幣)存入銀行
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract RewardToken is ERC20 {
constructor() ERC20("Reward Token", "RT") {
_mint(msg.sender, 100 * 1e18);
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract StakingToken is ERC20 {
constructor() ERC20("Staking Token", "ST") {
mint(msg.sender, 50000);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract XXXToken {
string public name;
string public symbol;
uint256 public totalSupply;
mapping(address => uint256) private balances;
address owner;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract XXXERC721 is ERC721 {
using Counters for Counters.Counter;
uint256 public mintPrice = 0.005 ether;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract WoWToken is ERC20 {
uint256 public _totalSupply = 10000;
constructor() ERC20("WoWToken", "WOW") {
_mint(msg.sender, _totalSupply);
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract WoWNFT is ERC721 {
constructor() ERC721("WoWNFT", "WOW") {}
function mint(uint256 tokenId) public {
_safeMint(msg.sender, tokenId);
@ChanJuiHuang
ChanJuiHuang / erc721-basic.sol
Last active August 12, 2022 01:46
erc721-basic.sol
// SPDX-License-Identifier: MIT
pragma solidity >= 0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract XDNFT is ERC721 {
using Counters for Counters.Counter;
uint256 totalSupply = 2;