본문 바로가기

WATTO 프로젝트/컨트렉트7

Ethereum 기반 컨트렉트 klaytn 환경으로 변경 수정 중 2022. 2. 14.
NFT 경매 NFT 관련 글이 길어 경매 파트는 따로 정리 event Start(); event Bid(address indexed sender, uint amount); event Withdraw(address indexed bidder, uint amount); event End(address winner, uint amount); event Endedat(uint a); struct Auction { bool started; address owner; uint nftId; bool status; uint endAt; address highestBidder; uint highestBid; bool ended; } mapping(uint => Auction) auction; mapping(uint => mappin.. 2022. 2. 13.
NFT 컨트렉트 NFT는 ERC-721로 구성되어 있으며 NWT_Token으로 구매가 가능하다. // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "../node_modules/@openzeppelin/contracts/utils/Counters.sol"; import "../node_modules/@openzeppelin/contracts/access/Ownable.sol"; import "../node_modules/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStor.. 2022. 2. 13.
Token_Swap WT_Token과 NWT_Token을 교환 해주는 컨트렉트 // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.10; import "../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract TokenSwap{ IERC20 public token1; // stable coin IERC20 public token2; // 유동성 코인 address public owner2; // server address constructor (address _token1,.. 2022. 2. 13.
WT_Token 배팅 컨트렉트가 포함된 stable coin // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "../node_modules/@openzeppelin/contracts/access/Ownable.sol"; contract WTToken is ERC20, Ownable { uint256 _amountToken; //배팅을 하는 플레이어에 대한 구조체 struct Player { address addr; // 주소 uint256 playerBetAmount; // 베팅 금액 string vote; // 후보에게 .. 2022. 2. 12.
NWT_Token WATTO project 에서 NFT를 구매 할 수 있는 코인 // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.10; import "../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "../node_modules/@openzeppelin/contracts/access/Ownable.sol"; contract NWTToken is ERC20, Ownable { constructor() ERC20("NWToken", "NWT") { } function mintToken(address to, uint256 amount) public onlyAuthorized returns (boo.. 2022. 2. 12.