rules

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Command = &cobra.Command{
		Use:   "rules",
		Short: "Compliance-rule utilities",
	}

	DeployCommand = &cobra.Command{
		Use:   "deploy <name>",
		Short: "Deploys a new <name> compliance-rule",
		Example: `t0ken rules deploy restrictAll --keystoreAddress owner
Available Rules:
  - restrict
  - restrictAll
  - restrictDuringLockup
  - restrictFromAdvisor
  - restrictFromAffiliate
  - restrictFromInvestor
  - restrictHolderThreshold
  - restrictToAccreditedInvestor
  - restrictToBrokerOrCustodialAccount
  - restrictToContract
  - restrictToCustodianOrCustodialAccountOrBroker
  - restrictToDepositingAccount
  - restrictToEscrow
  - restrictTransferFrom`,
		Args:   cobra.ExactArgs(1),
		PreRun: commands.ConnectWithKeyStore,
		Run: func(cmd *cobra.Command, args []string) {
			var (
				addr common.Address
				tx   *types.Transaction
				err  error
			)

			switch args[0] {
			case "restrict":
				addr, tx, _, err = rules.DeployRestrict(cli.Conn.Opts, cli.Conn.Client)
			case "restrictAll":
				addr, tx, _, err = rules.DeployRestrictAll(cli.Conn.Opts, cli.Conn.Client)
			case "restrictDuringLockup":
				addr, tx, _, err = rules.DeployRestrictDuringLockup(cli.Conn.Opts, cli.Conn.Client)
			case "restrictFromAdvisor":
				addr, tx, _, err = rules.DeployRestrictFromAdvisor(cli.Conn.Opts, cli.Conn.Client)
			case "restrictFromAffiliate":
				addr, tx, _, err = rules.DeployRestrictFromAffiliate(cli.Conn.Opts, cli.Conn.Client)
			case "restrictFromInvestor":
				addr, tx, _, err = rules.DeployRestrictFromInvestor(cli.Conn.Opts, cli.Conn.Client)
			case "restrictHolderThreshold":
				addr, tx, _, err = rules.DeployRestrictHolderThreshold(cli.Conn.Opts, cli.Conn.Client)
			case "restrictToAccreditedInvestor":
				addr, tx, _, err = rules.DeployRestrictToAccreditedInvestor(cli.Conn.Opts, cli.Conn.Client)
			case "restrictToBrokerOrCustodialAccount":
				addr, tx, _, err = rules.DeployRestrictToBrokerOrCustodialAccount(cli.Conn.Opts, cli.Conn.Client)
			case "restrictToContract":
				addr, tx, _, err = rules.DeployRestrictToContract(cli.Conn.Opts, cli.Conn.Client)
			case "restrictToCustodianOrCustodialAccountOrBroker":
				addr, tx, _, err = rules.DeployRestrictToCustodianOrCustodialAccountOrBroker(cli.Conn.Opts, cli.Conn.Client)
			case "restrictToDepositingAccount":
				addr, tx, _, err = rules.DeployRestrictToDepositingAccount(cli.Conn.Opts, cli.Conn.Client)
			case "restrictToEscrow":
				addr, tx, _, err = rules.DeployRestrictToEscrow(cli.Conn.Opts, cli.Conn.Client)
			case "restrictTransferFrom":
				addr, tx, _, err = rules.DeployRestrictTransferFrom(cli.Conn.Opts, cli.Conn.Client)
			}

			cli.CheckErr(cmd, err)
			cmd.Println("   Contract:", addr.String())
			cli.PrintTransactionFn(cmd)(tx, nil)
		},
	}
)
View Source
var GetterCommands = []*cobra.Command{
	&cobra.Command{
		Use:     "name <address>",
		Short:   "Gets the name of the rule at the <address>",
		Example: "t0ken rules name 0xa16e2faddd9469e5076c33ae53a2c6f40a058413",
		Args:    cli.AddressArgFunc("address", 0),
		Run: func(cmd *cobra.Command, args []string) {
			addr := common.HexToAddress(args[0])
			cli.Connect(cmd, args)
			caller, err := rules.NewRuleCaller(addr, cli.Conn.Client)
			cli.CheckErr(cmd, err)
			cli.CheckGetter(cmd)(caller.Name(&bind.CallOpts{}))
		},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL