1. mint一个勋章
// mint
tran, err := contractInstance.Mint(transactopts, common.HexToAddress(config.TestUserPublicKey), pinfo)
if err != nil {
fmt.Println(err)
return
}
txHash := tran.Hash().Hex()
fmt.Printf("txHash:%v\n", txHash)
2. scan查看该勋章
3. transfer该勋章
fromAddress := "0x11111111111111"
recvAddress := "0xfF58Ea566e1"
tokenId := big.NewInt(1)
// 调用 ERC-721 合约的 transfer 函数
tx, err := contractInstance.TransferFrom(
transactopts,
common.HexToAddress(fromAddress),
common.HexToAddress(recvAddress),
tokenId) // 传递的 token ID
if err != nil {
log.Fatal(err)
}
4. scan上转出用户查看transfer
4. scan上转入用户查看transfer
可以看到当前3个总量,该地址拥有balance1个
标签:err,scan,HexToAddress,transfer,txHash,common,721,合约 From: https://www.cnblogs.com/zhanchenjin/p/18072461