Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Command = &cobra.Command{ Use: "token", Short: "T0ken utilities", } DeployCommand = &cobra.Command{ Use: "deploy <name> <symbol> <decimals>", Short: "Deploys a new t0ken contract", Example: "t0ken token deploy --keystoreAddress owner", Args: cli.ChainArgs(cobra.ExactArgs(3), cli.UintArgFunc("decimals", 2, 8)), PreRun: commands.ConnectWithKeyStore, Run: func(cmd *cobra.Command, args []string) { name := args[0] symbol := args[1] decimals, err := strconv.ParseInt(args[2], 10, 8) addr, tx, _, err := erc20.DeployT0ken(cli.Conn.Opts, cli.Conn.Client, name, symbol, uint8(decimals)) cli.CheckErr(cmd, err) cmd.Println(" Contract:", addr.String()) cli.PrintTransactionFn(cmd)(tx, nil) }, } AuditCommand = &cobra.Command{ Use: "audit", Short: "Audit the holders of the t0ken, outputting CSV to <stdout>", PreRun: connectCaller, Run: func(cmd *cobra.Command, arts []string) { header, err := cli.Conn.HeaderByNumber(context.Background(), nil) cli.CheckErr(cmd, err) callSession.CallOpts.BlockNumber = header.Number n, err := callSession.Shareholders() cli.CheckErr(cmd, err) one := big.NewInt(1) index := big.NewInt(0) cmd.Printf("Block: %s\n", header.Number.String()) fmt.Println("address,tokens") for i := int64(0); i < n.Int64(); i++ { holder, err := callSession.HolderAt(index) cli.CheckErr(cmd, err) balance, err := callSession.BalanceOf(holder) cli.CheckErr(cmd, err) fmt.Printf("%s,%s\n", holder.String(), balance.String()) index.Add(index, one) } }, } )
View Source
var GetterCommands = []*cobra.Command{ &cobra.Command{ Use: "abi", Short: "Outputs the T0ken ABI", Example: "t0ken investor abi", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { cmd.Println(erc20.T0kenABI) }, }, &cobra.Command{ Use: "bin", Short: "Outputs the T0ken Binary", Example: "t0ken investor bin", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { cmd.Println(erc20.T0kenBin) }, }, &cobra.Command{ Use: "allowance <owner> <spender>", Short: "Gets the amount of tokens the <owner> has approved the <spender> to transfer", Example: "t0ken token allowance 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 0xa01a0a93716633058d69a28fbd472fd40e7c6b79", Args: cli.ChainArgs(cobra.ExactArgs(2), cli.AddressArgFunc("owner", 0), cli.AddressArgFunc("spender", 1)), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { owner := common.HexToAddress(args[0]) spender := common.HexToAddress(args[1]) cli.CheckGetter(cmd)(callSession.Allowance(owner, spender)) }, }, &cobra.Command{ Use: "balanceOf <address>", Short: "Gets the balance of the given <address>", Example: "t0ken token balanceOf 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.ChainArgs(cobra.MaximumNArgs(1), cli.AddressArgFunc("address", 0)), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) cli.CheckGetter(cmd)(callSession.BalanceOf(addr)) }, }, &cobra.Command{ Use: "cancellations <address>", Short: "Gets the replacement address of the given <address>, or a zero-address when it has not been cancelled", Example: "t0ken token cancellations 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.ChainArgs(cobra.MaximumNArgs(1), cli.AddressArgFunc("address", 0)), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) cli.CheckAddressGetter(cmd)(callSession.Cancellations(addr)) }, }, &cobra.Command{ Use: "compliance", Short: "Gets the compliance contract address for the t0ken", Example: "t0ken token compliance", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckAddressGetter(cmd)(callSession.Compliance()) }, }, &cobra.Command{ Use: "decimals", Short: "Gets the number of decimals the t0ken is set to", Example: "t0ken token decimals", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckGetter(cmd)(callSession.Decimals()) }, }, &cobra.Command{ Use: "getSuperseded <address>", Short: "Gets the superseded address of the given <address>", Example: "t0ken token getSuperseded 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.ChainArgs(cobra.MaximumNArgs(1), cli.AddressArgFunc("address", 0)), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) cli.CheckAddressGetter(cmd)(callSession.GetSuperseded(addr)) }, }, &cobra.Command{ Use: "holderAt <index>", Short: "Gets the holder address at the given <index>", Example: "t0ken token holderAt 5", Args: cli.ChainArgs(cobra.MaximumNArgs(1), cli.IntArgFunc("index", 0)), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { index, _ := new(big.Int).SetString(args[0], 10) cli.CheckAddressGetter(cmd)(callSession.HolderAt(index)) }, }, &cobra.Command{ Use: "isHolder <address>", Short: "Checks if the given <address> is a current holder", Example: "t0ken token isHolder 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.ChainArgs(cobra.MaximumNArgs(1), cli.AddressArgFunc("address", 0)), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) cli.CheckGetter(cmd)(callSession.IsHolder(addr)) }, }, &cobra.Command{ Use: "isSuperseded <address>", Short: "Checks if the <address> is superseded by another", Example: "t0ken token isSuperseded 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.ChainArgs(cobra.MaximumNArgs(1), cli.AddressArgFunc("address", 0)), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) cli.CheckGetter(cmd)(callSession.IsSuperseded(addr)) }, }, &cobra.Command{ Use: "issuer", Short: "Gets the issuer of the t0ken", Example: "t0ken token issuer", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckAddressGetter(cmd)(callSession.Issuer()) }, }, &cobra.Command{ Use: "issuingFinished", Short: "Returns if issuing has been finished", Example: "t0ken token issuingFinished", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckGetter(cmd)(callSession.IssuingFinished()) }, }, &cobra.Command{ Use: "name", Short: "Gets the name of the t0ken", Example: "t0ken token name", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckGetter(cmd)(callSession.Name()) }, }, &cobra.Command{ Use: "shareholders", Short: "Gets the total number of shareholders", Example: "t0ken token shareholders", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckGetter(cmd)(callSession.Shareholders()) }, }, &cobra.Command{ Use: "symbol", Short: "Gets the symbol of the t0ken", Example: "t0ken token symbol", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckGetter(cmd)(callSession.Symbol()) }, }, &cobra.Command{ Use: "totalSupply", Short: "Gets the total supply", Example: "t0ken token totalSupply", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckGetter(cmd)(callSession.TotalSupply()) }, }, }
View Source
var SetterCommands = []*cobra.Command{ &cobra.Command{ Use: "approve <address> <tokens>", Short: "Approves <address> to transfer <tokens> on your behalf", Example: "t0ken token approve 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 0xa01a0a93716633058d69a28fbd472fd40e7c6b79 --keystoreAddress 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.ChainArgs(cobra.MaximumNArgs(2), cli.AddressArgFunc("address", 0), cli.BigIntArgFunc("tokens", 1)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) quantity, _ := new(big.Int).SetString(args[1], 10) cli.PrintTransactionFn(cmd)(transSession.Approve(addr, quantity)) }, }, &cobra.Command{ Use: "cancelAndReissue <originalAddress> <replacementAddress>", Short: "Cancels the <originalAddress> and replaces it with <replacemenmtAddress>", Example: "t0ken token cancelAndReissue 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 0xa01a0a93716633058d69a28fbd472fd40e7c6b79 --keystoreAddress issuer", Args: cli.ChainArgs(cobra.ExactArgs(2), cli.AddressArgFunc("originalAddress", 0), cli.AddressArgFunc("replacementAddress", 1)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) replacement := common.HexToAddress(args[1]) cli.PrintTransactionFn(cmd)(transSession.CancelAndReissue(addr, replacement)) }, }, &cobra.Command{ Use: "finishIssuing", Short: "Finishes issuing for the token (can't be undone)", Example: "t0ken token finishIssuing --keystoreAddress issuer", Args: cobra.NoArgs, PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { cli.PrintTransactionFn(cmd)(transSession.FinishIssuing()) }, }, &cobra.Command{ Use: "issueTokens <quantity>", Short: "Issues <quantity> of tokens to the issuer", Example: "t0ken token issueTokens 5000 --keystoreAddress issuer", Args: cli.IntArgFunc("quantity", 0), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { quantity, _ := new(big.Int).SetString(args[0], 10) cli.PrintTransactionFn(cmd)(transSession.IssueTokens(quantity)) }, }, &cobra.Command{ Use: "setCompliance <address>", Short: "Sets the compliance contract <address>", Example: "t0ken token setCompliance 0x397e7b9c15ff22ba67ec6e78f46f1e21540bcb36 --keystoreAddress owner", Args: cli.ChainArgs(cobra.ExactArgs(1), cli.AddressArgFunc("address", 0)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) cli.PrintTransactionFn(cmd)(transSession.SetCompliance(addr)) }, }, &cobra.Command{ Use: "setIssuer <address>", Short: "Sets the issuer to the <address>", Example: "t0ken token setIssuer 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b --keystoreAddress owner", Args: cli.ChainArgs(cobra.ExactArgs(1), cli.AddressArgFunc("address", 0)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) cli.PrintTransactionFn(cmd)(transSession.SetIssuer(addr)) }, }, &cobra.Command{ Use: "transfer <address> <quantity>", Short: "Transfers <quantity> of tokens from your address to <address>", Example: "t0ken token transfer 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 15 --keystoreAddress 0xa01a0a93716633058d69a28fbd472fd40e7c6b79", Args: cli.ChainArgs(cobra.MaximumNArgs(2), cli.AddressArgFunc("address", 0), cli.BigIntArgFunc("quantity", 1)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) qty, _ := new(big.Int).SetString(args[1], 10) cli.PrintTransactionFn(cmd)(transSession.Transfer(addr, qty)) }, }, &cobra.Command{ Use: "transferFrom <sender> <recipient> <quantity>", Short: "Transfers <quantity> of tokens from the <sender> address to the <recipient> address (requires approval)", Example: "t0ken token transferFrom 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 0xf02f537578d03f6aece28f249eac19542d848f20 15 --keystoreAddress 0xa01a0a93716633058d69a28fbd472fd40e7c6b79", Args: cli.ChainArgs(cobra.MaximumNArgs(3), cli.AddressArgFunc("sender", 0), cli.AddressArgFunc("recipient", 1), cli.BigIntArgFunc("quantity", 2)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { sender := common.HexToAddress(args[0]) recipient := common.HexToAddress(args[1]) qty, _ := new(big.Int).SetString(args[2], 10) cli.PrintTransactionFn(cmd)(transSession.TransferFrom(sender, recipient, qty)) }, }, &cobra.Command{ Use: "transferOverride <sender> <recipient> <quantity>", Short: "Transfers <quantity> of tokens from the <sender> address to the <recipient> address (invoker must be an admin, and t0ken must have compliance set)", Example: "t0ken token transferOverride 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 0xf02f537578d03f6aece28f249eac19542d848f20 15 --keystoreAddress admin", Args: cli.ChainArgs(cobra.MaximumNArgs(3), cli.AddressArgFunc("sender", 0), cli.AddressArgFunc("recipient", 1), cli.BigIntArgFunc("quantity", 2)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { sender := common.HexToAddress(args[0]) recipient := common.HexToAddress(args[1]) qty, _ := new(big.Int).SetString(args[2], 10) cli.PrintTransactionFn(cmd)(transSession.TransferOverride(sender, recipient, qty)) }, }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.