Created
June 19, 2022 19:31
-
-
Save ericvanderwal/530596d828d4d5a3922f6c833326bb87 to your computer and use it in GitHub Desktop.
Sample Godwoken ChainSafe SDK ERC20 Token Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Numerics; | |
using UnityEngine; | |
public class GetERC20TokenInfo : MonoBehaviour | |
{ | |
// Chain == Chain name connecting | |
[SerializeField] private string chain = "godwoken"; | |
// Network == The network RPC name | |
[SerializeField] private string network = "testnet-v1"; | |
// USDC address == Token Contract Address | |
[SerializeField] private string contract = "0x088338e5df007e2d7b38fd6a1ebc1eb766c6e360"; | |
// rpc of chain | |
[SerializeField] private string rpc = "https://godwoken-testnet-v1.ckbapp.dev"; | |
async void Start() | |
{ | |
BigInteger balanceOf = await ERC20.BalanceOf(chain, network, contract, rpc); | |
Debug.Log(balanceOf); | |
string symbol = await ERC20.Symbol(chain, network, contract, rpc); | |
Debug.Log(symbol); | |
string name = await ERC20.Name(chain, network, contract, rpc); | |
Debug.Log(name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment