Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Command = &cobra.Command{ Use: "escrow", Short: "Escrow utilities", } DeployCommand = &cobra.Command{ Use: "deploy <registry>", Short: "Deploys a new Escrow contract", Example: "t0ken escrow 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 := escrow.DeployEscrow(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 escrow removed events within the given block range", Example: `t0ken token filterAdded --start 8658083 t0ken token filterAdded --start 8658083 --end 8700000 t0ken token filterAdded --symbols TZROP,OSTKO t0ken token filterAdded --tokens 0xf01fF29DCbEE147e9cA151a281bFdf136f66A45b t0ken token filterAdded --grantors 0xf01fF29DCbEE147e9cA151a281bFdf136f66A45b,0xf02f537578d03f6AeCE28F249eaC19542D848F20`, PreRun: connectFilterer, Run: func(cmd *cobra.Command, args []string) { symbols, err := cli.StringsFlag(cmd, "symbols", false) cli.CheckErr(cmd, err) tokens, err := cli.AddressesFlag(cmd, "tokens", false) cli.CheckErr(cmd, err) grantors, err := cli.AddressesFlag(cmd, "grantors", false) cli.CheckErr(cmd, err) opts := cli.FilterOpts(cmd) i, err := filterer.FilterEscrowAdded(&opts, symbols, tokens, grantors) cli.CheckErr(cmd, err) defer i.Close() fmt.Println("block,symbol-hash,token,grantor") for i.Next() { cli.CheckErr(cmd, i.Error()) e := i.Event fmt.Printf("%d,%s,%s,%s\n", e.Raw.BlockNumber, e.Symbol.String(), e.Token.String(), e.Grantor.String()) } }, }, &cobra.Command{ Use: "filterRemoved", Short: "Filters escrow added events within the given block range", Example: `t0ken token filterRemoved --start 8658083 t0ken token filterRemoved --start 8658083 --end 8700000 t0ken token filterRemoved --symbols TZROP,OSTKO t0ken token filterRemoved --tokens 0xf01fF29DCbEE147e9cA151a281bFdf136f66A45b t0ken token filterRemoved --grantors 0xf01fF29DCbEE147e9cA151a281bFdf136f66A45b,0xf02f537578d03f6AeCE28F249eaC19542D848F20`, PreRun: connectFilterer, Run: func(cmd *cobra.Command, args []string) { symbols, err := cli.StringsFlag(cmd, "symbols", false) cli.CheckErr(cmd, err) tokens, err := cli.AddressesFlag(cmd, "tokens", false) cli.CheckErr(cmd, err) grantors, err := cli.AddressesFlag(cmd, "grantors", false) cli.CheckErr(cmd, err) opts := cli.FilterOpts(cmd) i, err := filterer.FilterEscrowRemoved(&opts, symbols, tokens, grantors) cli.CheckErr(cmd, err) defer i.Close() fmt.Println("block,symbol-hash,token,grantor") for i.Next() { cli.CheckErr(cmd, i.Error()) e := i.Event fmt.Printf("%d,%s,%s,%s\n", e.Raw.BlockNumber, e.Symbol.String(), e.Token.String(), e.Grantor.String()) } }, }, }
View Source
var GetterCommands = []*cobra.Command{ &cobra.Command{ Use: "abi", Short: "Outputs the Escrow ABI", Example: "t0ken escrow abi", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { cmd.Println(e.EscrowABI) }, }, &cobra.Command{ Use: "bin", Short: "Outputs the Escrow Binary", Example: "t0ken escrow bin", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { cmd.Println(e.EscrowBin) }, }, &cobra.Command{ Use: "registry", Short: "Gets the Registry contract address", Example: "t0ken escrow registry", Args: cobra.NoArgs, PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { cli.CheckAddressGetter(cmd)(callSession.Registry()) }, }, &cobra.Command{ Use: "ledger <token> <grantor>", Short: "Gets the total number of tokens in escrow for the <grantor> of the <token>", Example: "t0ken escrow ledger 0x2c8091e6f63d9efde70cb278e3c91934d85462d2 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b", Args: cli.ChainArgs(cli.AddressArgFunc("token", 0), cli.AddressArgFunc("grantor", 1)), PreRun: connectCaller, Run: func(cmd *cobra.Command, args []string) { token := common.HexToAddress(args[0]) grantor := common.HexToAddress(args[1]) cli.CheckGetter(cmd)(callSession.Ledger(token, grantor)) }, }, }
View Source
var SetterCommands = []*cobra.Command{ &cobra.Command{ Use: "setRegistry <address>", Short: "Sets the registry contract to <address>", Example: "t0ken escrow 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)) }, }, &cobra.Command{ Use: "accept <token> <holder> <quantity> <grantee>", Short: "Accepts the escrow for the <token>/<holder> pair, sending the <quantity> to the <grantee>", Example: "t0ken escrow accept 0x5bd5b4e1a2c9b12812795e7217201b78c8c10b78 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 5 0xa01a0a93716633058d69a28fbd472fd40e7c6b79 ", Args: cli.ChainArgs(cli.AddressArgFunc("token", 0), cli.AddressArgFunc("holder", 1), cli.BigIntArgFunc("tokens", 2), cli.AddressArgFunc("grantee", 3)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { token := common.HexToAddress(args[0]) holder := common.HexToAddress(args[1]) quantity, _ := new(big.Int).SetString(args[2], 10) grantee := common.HexToAddress(args[3]) cli.PrintTransactionFn(cmd)(transSession.Accept(token, holder, quantity, grantee)) }, }, &cobra.Command{ Use: "reject <token> <holder> <quantity>", Short: "Rejects the escrow for the <token>/<holder> pair, sending the <quantity> back to the <holder>", Example: "t0ken escrow accept 0x5bd5b4e1a2c9b12812795e7217201b78c8c10b78 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 5", Args: cli.ChainArgs(cli.AddressArgFunc("token", 0), cli.AddressArgFunc("holder", 1), cli.BigIntArgFunc("tokens", 2)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { token := common.HexToAddress(args[0]) holder := common.HexToAddress(args[1]) quantity, _ := new(big.Int).SetString(args[2], 10) cli.PrintTransactionFn(cmd)(transSession.Reject(token, holder, quantity)) }, }, &cobra.Command{ Use: "record <token> <holder> <quantity>", Short: "Records the escrow for the <token>/<holder> pair for the <quantity> of tokens", Example: "t0ken escrow accept 0x5bd5b4e1a2c9b12812795e7217201b78c8c10b78 0xf01ff29dcbee147e9ca151a281bfdf136f66a45b 5", Args: cli.ChainArgs(cli.AddressArgFunc("token", 0), cli.AddressArgFunc("holder", 1), cli.BigIntArgFunc("tokens", 2)), PreRun: connectTransactor, Run: func(cmd *cobra.Command, args []string) { token := common.HexToAddress(args[0]) holder := common.HexToAddress(args[1]) quantity, _ := new(big.Int).SetString(args[2], 10) cli.PrintTransactionFn(cmd)(transSession.Record(token, holder, quantity)) }, }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.