# KryptoCamp 第二周
基本題
引用 OpenZeppelin ERC20 部署一個自定義的 ERC20 Token 在 Goerli 鏈上
1. 開源合約並提交合約地址 **(2023/3/18還未實現)**
2. 實作 mint 和 burn 功能
3. 轉移 100 個 Token 到以下地址 0x6e24f0fF0337edf4af9c67bFf22C402302fc94D3
4. 轉移 Token 給所有組員

```solidity=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.18 <0.9.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// testGoaDuck tGD
contract testGaoDuckToken is ERC20{
constructor (string memory name, string memory symbol) ERC20(name,symbol){
}
function mint(address account, uint256 amount) external {
_mint(account, amount * (10 ** decimals()));
}
function burn(address account, uint256 amount) external{
_burn(account, amount * (10 ** decimals()));
}
}
//0xae6B0f75b55fa4c90b2768e3157b7000241A41c5
```
引用 OpenZeppelin ERC721 部署一個 ERC721 NFT 合約,同時擁有付費 mint 功能
1. 開源合約並提交合約地址
2. 將檔案上傳至 ipfs
3. 擁有白名單機制並且將組員加入白名單 **(2023/3/18還未實現)**
4. 加入一種自定義功能,例如:荷蘭拍、盲盒、返佣、融合…**(2023/3/18還未實現)**
https://testnets.opensea.io/collection/txt-beomgyu-5
```solidity=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.18 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
//// testnet Fanart, BEOMGYU painted by @xizhiii
contract FanartNFT is ERC721 {
uint256 public totle_Supply = 0;
address public creater;
address[] public owner;
uint256 public max_Supply=5;
uint256 public mintPrice = 0.01 ether;
// using Strings for uint256;
constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {
creater = msg.sender;
}
function mint() public payable {
require(totle_Supply<max_Supply);
require(msg.value >= mintPrice, "Insufficient payment.");
_safeMint(msg.sender, totle_Supply);
owner.push(msg.sender);
totle_Supply++;
}
function _baseURI() internal pure override returns (string memory) {
return "https://gateway.pinata.cloud/ipfs/QmZtd6uks6g92fhzoadBy8iVn3Lmdhg8AeycS1KUQXCsM4";
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
_requireMinted(_tokenId);
string memory baseURI = _baseURI();
string memory tokenIdStr = Strings.toString(_tokenId);
return string(abi.encodePacked(baseURI, "/", tokenIdStr, "/", tokenIdStr, ".json"));
}
function ownerOf(uint256 _tokenId) public view override returns (address){
if(_tokenId < max_Supply)
{
return owner[_tokenId];
}
else {
return address(0);
}
}
function withdraw() public {
require(msg.sender == creater, "Only the contract creator can call this function");
payable(msg.sender).transfer(address(this).balance);
}
}
//TXT BEOMGYU
//TXT Bear
//0xf85Dd6Fc6ED85099408A411e300B321647E3Cc1c
```