Skip to content

HyperPlay-Gaming/unity-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity Demo HyperPlay

Connect

Start Unity Project

  • Sync Balance: Uses web3.unity to fetch users balance. If the user has a token, then change character to red
    • Logic found in /Assets/HYPERPLAY/SyncBalance.cs
  • Mint Token: Connects to metamask wallet to mint a token
    • Logic found in /Assets/HYPERPLAY/MintToken.cs
  • Burn Tokens: Connects to metamask wallet to burn all of a players token. (a way to reset)
    • Logic found in /Assets/HYPERPLAY/BurnToken.cs

Solidity

https://goerli.etherscan.io/address/0xDD6ff2bA7fD02D19e8e4e1d99b65802eD9705437

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

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

contract ERC20Token is ERC20 {
    constructor() ERC20("Test Token20", "tTKN20") {}

    // mints 1 token
    function publicMint() public {
        _mint(msg.sender, 1);
    }

    // burns all of users token
    function publicBurn() public {
        _burn(msg.sender, this.balanceOf(msg.sender));
    }
}