Skip to content

Instantly share code, notes, and snippets.

@ericvanderwal
Created June 19, 2022 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericvanderwal/530596d828d4d5a3922f6c833326bb87 to your computer and use it in GitHub Desktop.
Save ericvanderwal/530596d828d4d5a3922f6c833326bb87 to your computer and use it in GitHub Desktop.
Sample Godwoken ChainSafe SDK ERC20 Token Script
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