github.com/iotexproject/iotex-core@v1.14.1-rc1/ioctl/newcmd/action/xrc20_const.go (about)

     1  // Copyright (c) 2022 IoTeX Foundation
     2  // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
     3  // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
     4  // This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
     5  
     6  package action
     7  
     8  import (
     9  	"strings"
    10  
    11  	"github.com/ethereum/go-ethereum/accounts/abi"
    12  	"github.com/pkg/errors"
    13  )
    14  
    15  const (
    16  	_xrc20ABI = `[
    17  		{
    18  			"constant": false,
    19  			"inputs": [
    20  				{
    21  					"name": "spender",
    22  					"type": "address"
    23  				},
    24  				{
    25  					"name": "value",
    26  					"type": "uint256"
    27  				}
    28  			],
    29  			"name": "approve",
    30  			"outputs": [
    31  				{
    32  					"name": "",
    33  					"type": "bool"
    34  				}
    35  			],
    36  			"payable": false,
    37  			"stateMutability": "nonpayable",
    38  			"type": "function"
    39  		},
    40  		{
    41  			"constant": true,
    42  			"inputs": [],
    43  			"name": "totalSupply",
    44  			"outputs": [
    45  				{
    46  					"name": "",
    47  					"type": "uint256"
    48  				}
    49  			],
    50  			"payable": false,
    51  			"stateMutability": "view",
    52  			"type": "function"
    53  		},
    54  		{
    55  			"constant": false,
    56  			"inputs": [
    57  				{
    58  					"name": "from",
    59  					"type": "address"
    60  				},
    61  				{
    62  					"name": "to",
    63  					"type": "address"
    64  				},
    65  				{
    66  					"name": "value",
    67  					"type": "uint256"
    68  				}
    69  			],
    70  			"name": "transferFrom",
    71  			"outputs": [
    72  				{
    73  					"name": "",
    74  					"type": "bool"
    75  				}
    76  			],
    77  			"payable": false,
    78  			"stateMutability": "nonpayable",
    79  			"type": "function"
    80  		},
    81  		{
    82  			"constant": true,
    83  			"inputs": [
    84  				{
    85  					"name": "who",
    86  					"type": "address"
    87  				}
    88  			],
    89  			"name": "balanceOf",
    90  			"outputs": [
    91  				{
    92  					"name": "",
    93  					"type": "uint256"
    94  				}
    95  			],
    96  			"payable": false,
    97  			"stateMutability": "view",
    98  			"type": "function"
    99  		},
   100  		{
   101  			"constant": false,
   102  			"inputs": [
   103  				{
   104  					"name": "to",
   105  					"type": "address"
   106  				},
   107  				{
   108  					"name": "value",
   109  					"type": "uint256"
   110  				}
   111  			],
   112  			"name": "transfer",
   113  			"outputs": [
   114  				{
   115  					"name": "",
   116  					"type": "bool"
   117  				}
   118  			],
   119  			"payable": false,
   120  			"stateMutability": "nonpayable",
   121  			"type": "function"
   122  		},
   123  		{
   124  			"constant": true,
   125  			"inputs": [
   126  				{
   127  					"name": "owner",
   128  					"type": "address"
   129  				},
   130  				{
   131  					"name": "spender",
   132  					"type": "address"
   133  				}
   134  			],
   135  			"name": "allowance",
   136  			"outputs": [
   137  				{
   138  					"name": "",
   139  					"type": "uint256"
   140  				}
   141  			],
   142  			"payable": false,
   143  			"stateMutability": "view",
   144  			"type": "function"
   145  		},
   146  		{
   147  			"anonymous": false,
   148  			"inputs": [
   149  				{
   150  					"indexed": true,
   151  					"name": "owner",
   152  					"type": "address"
   153  				},
   154  				{
   155  					"indexed": true,
   156  					"name": "spender",
   157  					"type": "address"
   158  				},
   159  				{
   160  					"indexed": false,
   161  					"name": "value",
   162  					"type": "uint256"
   163  				}
   164  			],
   165  			"name": "Approval",
   166  			"type": "event"
   167  		},
   168  		{
   169  			"anonymous": false,
   170  			"inputs": [
   171  				{
   172  					"indexed": true,
   173  					"name": "from",
   174  					"type": "address"
   175  				},
   176  				{
   177  					"indexed": true,
   178  					"name": "to",
   179  					"type": "address"
   180  				},
   181  				{
   182  					"indexed": false,
   183  					"name": "value",
   184  					"type": "uint256"
   185  				}
   186  			],
   187  			"name": "Transfer",
   188  			"type": "event"
   189  		}
   190  	]`
   191  )
   192  
   193  var xrc20abi abi.ABI
   194  
   195  func init() {
   196  	var err error
   197  	xrc20abi, err = abi.JSON(strings.NewReader(_xrc20ABI))
   198  	if err != nil {
   199  		panic(errors.Wrap(err, "cannot get abi JSON data"))
   200  	}
   201  }