Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Command = &cobra.Command{ Use: "externalInvestor", Short: "External Investor utilities", } DeployCommand = &cobra.Command{ Use: "deploy <registry>", Short: "Deploys a new investor contract", Example: "t0ken externalInvestor deploy 0x397e7b9c15ff22ba67ec6e78f46f1e21540bcb36 --keystoreAddress owner", Args: cli.AddressArgFunc("registry", 0), PreRun: commands.ConnectWithKeyStore, Run: func(cmd *cobra.Command, args []string) { registryAddress := common.HexToAddress(args[0]) addr, tx, _, err := registry.DeployExternalInvestor(cli.Conn.Opts, cli.Conn.Client, registryAddress) cli.CheckErr(cmd, err) cmd.Println(" Contract:", addr.String()) cli.PrintTransactionFn(cmd)(tx, nil) }, } )
View Source
var FilterCommands = []*cobra.Command{ &cobra.Command{ Use: "filterAdded", Short: "Filters investor added events within the given block range", Example: `t0ken externalInvestor filterAdded --start 8658083 t0ken externalInvestor filterAdded --start 8658083 --end 8700000 t0ken externalInvestor filterAdded --owners 0x0000d6AbC75370F48B42024371B07B4506885a55 t0ken externalInvestor filterAdded --investors 0xf01fF29DCbEE147e9cA151a281bFdf136f66A45b,0xf02f537578d03f6AeCE28F249eaC19542D848F20`, PreRun: connectFilterer, Run: func(cmd *cobra.Command, args []string) { investors, owners := filterArgs(cmd) opts := cli.FilterOpts(cmd) i, err := filterer.FilterInvestorAdded(&opts, investors, owners) cli.CheckErr(cmd, err) defer i.Close() fmt.Println("block,owner,investor") for i.Next() { cli.CheckErr(cmd, i.Error()) fmt.Printf("%d,%s,%s\n", i.Event.Raw.BlockNumber, i.Event.Owner.String(), i.Event.Investor.String()) } }, }, &cobra.Command{ Use: "filterRemoved", Short: "Filters investor removed events within the given block range", Example: `t0ken externalInvestor filterRemoved --start 8658083, t0ken externalInvestor filterRemoved --start 8658083 --end 8700000 t0ken externalInvestor filterRemoved --owners 0x0000d6AbC75370F48B42024371B07B4506885a55 t0ken externalInvestor filterRemoved --investors 0xf01fF29DCbEE147e9cA151a281bFdf136f66A45b,0xf02f537578d03f6AeCE28F249eaC19542D848F20`, PreRun: connectFilterer, Run: func(cmd *cobra.Command, args []string) { investors, owners := filterArgs(cmd) opts := cli.FilterOpts(cmd) i, err := filterer.FilterInvestorRemoved(&opts, investors, owners) cli.CheckErr(cmd, err) defer i.Close() fmt.Println("block,owner,investor") for i.Next() { cli.CheckErr(cmd, i.Error()) fmt.Printf("%d,%s,%s\n", i.Event.Raw.BlockNumber, i.Event.Owner.String(), i.Event.Investor.String()) } }, }, &cobra.Command{ Use: "filterUpdated", Short: "Filters investor updated events within the given block range", Example: `t0ken externalInvestor filterUpdated --start 8658083 t0ken externalInvestor filterUpdated --start 8658083 --end 8700000 t0ken externalInvestor filterUpdated --owners 0x0000d6AbC75370F48B42024371B07B4506885a55 t0ken externalInvestor filterUpdated --investors 0xf01fF29DCbEE147e9cA151a281bFdf136f66A45b,0xf02f537578d03f6AeCE28F249eaC19542D848F20`, PreRun: connectFilterer, Run: func(cmd *cobra.Command, args []string) { investors, owners := filterArgs(cmd) opts := cli.FilterOpts(cmd) i, err := filterer.FilterInvestorUpdated(&opts, investors, owners) cli.CheckErr(cmd, err) defer i.Close() fmt.Println("block,owner,investor") for i.Next() { cli.CheckErr(cmd, i.Error()) fmt.Printf("%d,%s,%s\n", i.Event.Raw.BlockNumber, i.Event.Owner.String(), i.Event.Investor.String()) } }, }, &cobra.Command{ Use: "filterFrozen [frozen]", Short: "Filters investor frozen events within the given block range", Example: `t0ken externalInvestor filterFrozen true --start 8658083 t0ken externalInvestor filterFrozen --start 8658083 --end 8700000 t0ken externalInvestor filterFrozen --owners 0x0000d6AbC75370F48B42024371B07B4506885a55 t0ken externalInvestor filterFrozen false --investors 0xf01fF29DCbEE147e9cA151a281bFdf136f66A45b,0xf02f537578d03f6AeCE28F249eaC19542D848F20`, Args: cobra.MaximumNArgs(1), PreRun: connectFilterer, Run: func(cmd *cobra.Command, args []string) { var frozen []bool if len(args) > 0 { b, err := strconv.ParseBool(args[0]) if err != nil { cli.CheckErr(cmd, errors.New("invalid value for [frozen] arg")) } frozen = append(frozen, b) } investors, owners := filterArgs(cmd) opts := cli.FilterOpts(cmd) i, err := filterer.FilterInvestorFrozen(&opts, investors, frozen, owners) cli.CheckErr(cmd, err) defer i.Close() fmt.Println("block,owner,investor,frozen") for i.Next() { cli.CheckErr(cmd, i.Error()) fmt.Printf("%d,%s,%s\n", i.Event.Raw.BlockNumber, i.Event.Owner.String(), i.Event.Investor.String(), i.Event.Frozen) } }, }, }
View Source
var GetterCommands = []*cobra.Command{ &cobra.Command{ Use: "abi", Short: "Outputs the External Investor Registry ABI", Example: "t0ken externalInvestor abi", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { cmd.Println(registry.ExternalInvestorABI) }, }, &cobra.Command{ Use: "bin", Short: "Outputs the External Investor Registry Binary", Example: "t0ken externalInvestor bin", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { cmd.Println(registry.ExternalInvestorBin) }, }, &cobra.Command{ Use: "getAccreditation <investor>", Short: "Gets the accreditation date of the <investor>", Example: "t0ken externalInvestor getAccreditation 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.AddressArgFunc("investor", 0), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { investor := common.HexToAddress(args[0]) cli.CheckAccreditationGetter(cmd)(callSession.GetAccreditation(investor)) }, }, &cobra.Command{ Use: "getCountry <investor>", Short: "Gets the country of the <investor>", Example: "t0ken externalInvestor getCountry 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.AddressArgFunc("investor", 0), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { investor := common.HexToAddress(args[0]) cli.CheckCountryGetter(cmd)(callSession.GetCountry(investor)) }, }, &cobra.Command{ Use: "getHash <investor>", Short: "Gets the hash of the <investor>", Example: "t0ken externalInvestor getHash 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.AddressArgFunc("investor", 0), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { investor := common.HexToAddress(args[0]) cli.CheckBytes32Getter(cmd)(callSession.GetHash(investor)) }, }, &cobra.Command{ Use: "registry", Short: "Gets the Registry contract address", Example: "t0ken externalInvestor registry", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckAddressGetter(cmd)(callSession.Registry()) }, }, }
View Source
var SetterCommands = []*cobra.Command{ &cobra.Command{ Use: "add <investor> <hash> <country> <accreditation>", Short: `Adds the <investor> address with the given <hash>, 2 character <country> code, and <accreditation> UTC date Accreditation can be in either format: '2006-01-02' or RFC3339(2006-01-02T15:04:05Z)`, Example: `t0ken externalInvestor add \ 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b \ 0xa1896382c22b03c562b0241324cfca19505cc5c78eb06751d9cee690e21ed6a1 \ US \ 2020-07-11 --keystoreAddress broker`, Args: cli.ChainArgs(cli.AddressArgFunc("investor", 0), cli.HexArgLenFunc("hash", 1, 16), cli.CountryCodeArgFunc("country", 2), cli.DateArgFunc("accreditation", 3)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { investor := common.HexToAddress(args[0]) h, _ := hexutil.Decode(args[1]) country, _ := cli.CountryFromArg(args[2]) accreditation, _ := cli.DateFromArg(args[3]) // Convert has to fixed size byte array var hash [32]byte copy(hash[:], h) cli.PrintTransactionFn(cmd)(transSession.Add(investor, hash, country, big.NewInt(accreditation.Unix()))) }, }, &cobra.Command{ Use: "remove <investor>", Short: "Removes the <investor> address --keystoreAddress broker", Example: "t0ken externalInvestor remove 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b --keystoreAddress broker", Args: cli.ChainArgs(cli.AddressArgFunc("investor", 0)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { investor := common.HexToAddress(args[0]) cli.PrintTransactionFn(cmd)(transSession.Remove(investor)) }, }, &cobra.Command{ Use: "setAccreditation <investor> <accreditation>", Short: `Sets the <investor> <accreditation> UTC date Accreditation can be in either format: '2006-01-02' or RFC3339(2006-01-02T15:04:05Z)`, Example: "t0ken externalInvestor setAccreditation 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 2020-07-11 --keystoreAddress broker", Args: cli.ChainArgs(cli.AddressArgFunc("investor", 0), cli.DateArgFunc("accreditation", 1)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { investor := common.HexToAddress(args[0]) accreditation, _ := cli.DateFromArg(args[2]) cli.PrintTransactionFn(cmd)(transSession.SetAccreditation(investor, big.NewInt(accreditation.Unix()))) }, }, &cobra.Command{ Use: "setCountry <inverstor> <country>", Short: "Sets the <investor> 2 character <country> code", Example: "t0ken externalInvestor setCountry 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b US --keystoreAddress broker", Args: cli.ChainArgs(cli.AddressArgFunc("investor", 0), cli.CountryCodeArgFunc("country", 1)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { investor := common.HexToAddress(args[0]) country, _ := cli.CountryFromArg(args[2]) cli.PrintTransactionFn(cmd)(transSession.SetCountry(investor, country)) }, }, &cobra.Command{ Use: "setFrozen <inverstor> <frozen>", Short: "Sets the <investor> to the <frozen> state", Example: "t0ken externalInvestor setFrozen 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b true --keystoreAddress broker", Args: cli.ChainArgs(cli.AddressArgFunc("investor", 0), cli.BoolArgFunc("frozen", 1)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { investor := common.HexToAddress(args[0]) frozen, _ := strconv.ParseBool(args[1]) cli.PrintTransactionFn(cmd)(transSession.SetFrozen(investor, frozen)) }, }, &cobra.Command{ Use: "setHash <inverstor> <hash>", Short: "Sets the <investor> <hash> value", Example: "t0ken externalInvestor setHash 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 0xa1896382c22b03c562b0241324cfca19505cc5c78eb06751d9cee690e21ed6a1 --keystoreAddress broker", Args: cli.ChainArgs(cli.AddressArgFunc("investor", 0), cli.HexArgLenFunc("hash", 1, 16)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { investor := common.HexToAddress(args[0]) h, _ := hexutil.Decode(args[1]) // Convert data to fixed size byte array var hash [32]byte copy(hash[:], h) cli.PrintTransactionFn(cmd)(transSession.SetHash(investor, hash)) }, }, &cobra.Command{ Use: "setRegistry <address>", Short: "Sets the registry contract to <address>", Example: "t0ken externalInvestor setRegistry 0x397e7b9c15ff22ba67ec6e78f46f1e21540bcb36 --keystoreAddress owner", Args: cli.AddressArgFunc("address", 0), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { addr := common.HexToAddress(args[0]) cli.PrintTransactionFn(cmd)(transSession.SetRegistry(addr)) }, }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.