code.vegaprotocol.io/vega@v0.79.0/commands/transfer_funds_test.go (about)

     1  // Copyright (C) 2023 Gobalsky Labs Limited
     2  //
     3  // This program is free software: you can redistribute it and/or modify
     4  // it under the terms of the GNU Affero General Public License as
     5  // published by the Free Software Foundation, either version 3 of the
     6  // License, or (at your option) any later version.
     7  //
     8  // This program is distributed in the hope that it will be useful,
     9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  // GNU Affero General Public License for more details.
    12  //
    13  // You should have received a copy of the GNU Affero General Public License
    14  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15  
    16  package commands_test
    17  
    18  import (
    19  	"errors"
    20  	"testing"
    21  
    22  	"code.vegaprotocol.io/vega/commands"
    23  	"code.vegaprotocol.io/vega/libs/ptr"
    24  	"code.vegaprotocol.io/vega/protos/vega"
    25  	commandspb "code.vegaprotocol.io/vega/protos/vega/commands/v1"
    26  
    27  	"github.com/stretchr/testify/assert"
    28  )
    29  
    30  func TestNilTransferFundsFails(t *testing.T) {
    31  	err := checkTransfer(nil)
    32  
    33  	assert.Contains(t, err.Get("transfer"), commands.ErrIsRequired)
    34  }
    35  
    36  func TestTransferFunds(t *testing.T) {
    37  	largeRankTable := make([]*vega.Rank, 0, 501)
    38  	for i := uint32(0); i < 501; i++ {
    39  		largeRankTable = append(largeRankTable, &vega.Rank{StartRank: i, ShareRatio: i})
    40  	}
    41  
    42  	capInvalidNumber := "banana"
    43  	capNegative := "-1"
    44  	capZero := "0"
    45  
    46  	tooLongTransferInterval := int32(101)
    47  	zeroTransferInterval := int32(0)
    48  	negativeTransferInterval := int32(-1)
    49  
    50  	notionalVolumeInvalidNumber := "banana"
    51  	notionalVolumeNegative := "-1"
    52  	notionalVolumeZero := "0"
    53  	notionalVolumeValid := "100"
    54  
    55  	cases := []struct {
    56  		transfer  commandspb.Transfer
    57  		errString string
    58  	}{
    59  		{
    60  			transfer: commandspb.Transfer{
    61  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
    62  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
    63  				Kind: &commandspb.Transfer_OneOff{
    64  					OneOff: &commandspb.OneOffTransfer{},
    65  				},
    66  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
    67  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
    68  				Amount:    "1",
    69  				Reference: "testing",
    70  			},
    71  		},
    72  		{
    73  			transfer: commandspb.Transfer{
    74  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_MARGIN,
    75  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
    76  				Kind: &commandspb.Transfer_OneOff{
    77  					OneOff: &commandspb.OneOffTransfer{},
    78  				},
    79  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
    80  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
    81  				Amount:    "1",
    82  				Reference: "testing",
    83  			},
    84  			errString: "transfer.from_account_type (is not a valid value)",
    85  		},
    86  		{
    87  			transfer: commandspb.Transfer{
    88  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
    89  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
    90  				Kind: &commandspb.Transfer_OneOff{
    91  					OneOff: &commandspb.OneOffTransfer{},
    92  				},
    93  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
    94  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
    95  				Amount:    "1",
    96  				Reference: "",
    97  			},
    98  		},
    99  		{
   100  			transfer: commandspb.Transfer{
   101  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   102  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   103  				Kind: &commandspb.Transfer_OneOff{
   104  					OneOff: &commandspb.OneOffTransfer{},
   105  				},
   106  				To:        "",
   107  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   108  				Amount:    "1",
   109  				Reference: "testing",
   110  			},
   111  			errString: "transfer.to (is required)",
   112  		},
   113  		{
   114  			transfer: commandspb.Transfer{
   115  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   116  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   117  				Kind: &commandspb.Transfer_OneOff{
   118  					OneOff: &commandspb.OneOffTransfer{},
   119  				},
   120  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   121  				Asset:     "",
   122  				Amount:    "1",
   123  				Reference: "testing",
   124  			},
   125  			errString: "transfer.asset (is required)",
   126  		},
   127  		{
   128  			transfer: commandspb.Transfer{
   129  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   130  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   131  				Kind: &commandspb.Transfer_OneOff{
   132  					OneOff: &commandspb.OneOffTransfer{},
   133  				},
   134  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   135  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   136  				Amount:    "",
   137  				Reference: "testing",
   138  			},
   139  			errString: "transfer.amount (is required)",
   140  		},
   141  		{
   142  			transfer: commandspb.Transfer{
   143  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   144  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   145  				Kind: &commandspb.Transfer_OneOff{
   146  					OneOff: &commandspb.OneOffTransfer{},
   147  				},
   148  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   149  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   150  				Amount:    "-1",
   151  				Reference: "testing",
   152  			},
   153  			errString: "transfer.amount (must be positive)",
   154  		},
   155  		{
   156  			transfer: commandspb.Transfer{
   157  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   158  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   159  				Kind: &commandspb.Transfer_OneOff{
   160  					OneOff: &commandspb.OneOffTransfer{},
   161  				},
   162  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   163  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   164  				Amount:    "0",
   165  				Reference: "testing",
   166  			},
   167  			errString: "transfer.amount (is required)",
   168  		},
   169  		{
   170  			transfer: commandspb.Transfer{
   171  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   172  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   173  				Kind: &commandspb.Transfer_OneOff{
   174  					OneOff: &commandspb.OneOffTransfer{},
   175  				},
   176  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   177  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   178  				Amount:    "1",
   179  				Reference: "testingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtest",
   180  			},
   181  			errString: "transfer.reference (must be less than 100 characters)",
   182  		},
   183  		{
   184  			transfer: commandspb.Transfer{
   185  				To:        "",
   186  				Asset:     "",
   187  				Amount:    "",
   188  				Reference: "",
   189  			},
   190  			errString: "transfer.amount (is required), transfer.asset (is required), transfer.from_account_type (is not a valid value), transfer.kind (is required), transfer.to (is required), transfer.to_account_type (is not a valid value)",
   191  		},
   192  		{
   193  			transfer: commandspb.Transfer{
   194  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   195  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   196  				Kind: &commandspb.Transfer_OneOff{
   197  					OneOff: &commandspb.OneOffTransfer{
   198  						DeliverOn: -1,
   199  					},
   200  				},
   201  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   202  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   203  				Amount:    "1",
   204  				Reference: "testing",
   205  			},
   206  			errString: "transfer.kind.deliver_on (must be positive or zero)",
   207  		},
   208  		{
   209  			transfer: commandspb.Transfer{
   210  				ToAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   211  				Kind: &commandspb.Transfer_OneOff{
   212  					OneOff: &commandspb.OneOffTransfer{},
   213  				},
   214  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   215  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   216  				Amount:    "1",
   217  				Reference: "testing",
   218  			},
   219  			errString: "transfer.from_account_type (is not a valid value)",
   220  		},
   221  		{
   222  			transfer: commandspb.Transfer{
   223  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   224  				Kind: &commandspb.Transfer_OneOff{
   225  					OneOff: &commandspb.OneOffTransfer{},
   226  				},
   227  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   228  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   229  				Amount:    "1",
   230  				Reference: "testing",
   231  			},
   232  			errString: "transfer.to_account_type (is not a valid value)",
   233  		},
   234  		{
   235  			transfer: commandspb.Transfer{
   236  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   237  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   238  				Kind: &commandspb.Transfer_Recurring{
   239  					Recurring: &commandspb.RecurringTransfer{},
   240  				},
   241  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   242  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   243  				Amount:    "1",
   244  				Reference: "testing",
   245  			},
   246  			errString: "transfer.kind.factor (not a valid float), transfer.kind.start_epoch (must be positive)",
   247  		},
   248  		{
   249  			transfer: commandspb.Transfer{
   250  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   251  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   252  				Kind: &commandspb.Transfer_Recurring{
   253  					Recurring: &commandspb.RecurringTransfer{
   254  						StartEpoch: 0,
   255  						EndEpoch:   ptr.From(uint64(10)),
   256  						Factor:     "1",
   257  					},
   258  				},
   259  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   260  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   261  				Amount:    "1",
   262  				Reference: "testing",
   263  			},
   264  			errString: "transfer.kind.start_epoch (must be positive)",
   265  		},
   266  		{
   267  			transfer: commandspb.Transfer{
   268  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   269  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   270  				Kind: &commandspb.Transfer_Recurring{
   271  					Recurring: &commandspb.RecurringTransfer{
   272  						StartEpoch: 10,
   273  						EndEpoch:   ptr.From(uint64(0)),
   274  						Factor:     "1",
   275  					},
   276  				},
   277  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   278  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   279  				Amount:    "1",
   280  				Reference: "testing",
   281  			},
   282  			errString: "transfer.kind.end_epoch (must be positive, must be after start_epoch)",
   283  		},
   284  		{
   285  			transfer: commandspb.Transfer{
   286  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   287  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   288  				Kind: &commandspb.Transfer_Recurring{
   289  					Recurring: &commandspb.RecurringTransfer{
   290  						StartEpoch: 10,
   291  						EndEpoch:   ptr.From(uint64(11)),
   292  						Factor:     "-1",
   293  					},
   294  				},
   295  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   296  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   297  				Amount:    "1",
   298  				Reference: "testing",
   299  			},
   300  			errString: "transfer.kind.factor (must be positive)",
   301  		},
   302  		{
   303  			transfer: commandspb.Transfer{
   304  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   305  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
   306  				Kind: &commandspb.Transfer_Recurring{
   307  					Recurring: &commandspb.RecurringTransfer{
   308  						StartEpoch: 10,
   309  						EndEpoch:   ptr.From(uint64(11)),
   310  						Factor:     "0.01",
   311  					},
   312  				},
   313  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   314  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   315  				Amount:    "1",
   316  				Reference: "testing",
   317  			},
   318  		},
   319  		{
   320  			transfer: commandspb.Transfer{
   321  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   322  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
   323  				Kind: &commandspb.Transfer_OneOff{
   324  					OneOff: &commandspb.OneOffTransfer{},
   325  				},
   326  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   327  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   328  				Amount:    "1",
   329  				Reference: "testing",
   330  			},
   331  			errString: "transfer.account.to (transfers to metric-based reward accounts must be recurring transfers that specify a distribution metric)",
   332  		},
   333  		{
   334  			transfer: commandspb.Transfer{
   335  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   336  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES,
   337  				Kind: &commandspb.Transfer_OneOff{
   338  					OneOff: &commandspb.OneOffTransfer{},
   339  				},
   340  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   341  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   342  				Amount:    "1",
   343  				Reference: "testing",
   344  			},
   345  			errString: "transfer.account.to (transfers to metric-based reward accounts must be recurring transfers that specify a distribution metric)",
   346  		},
   347  		{
   348  			transfer: commandspb.Transfer{
   349  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   350  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES,
   351  				Kind: &commandspb.Transfer_OneOff{
   352  					OneOff: &commandspb.OneOffTransfer{},
   353  				},
   354  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   355  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   356  				Amount:    "1",
   357  				Reference: "testing",
   358  			},
   359  			errString: "transfer.account.to (transfers to metric-based reward accounts must be recurring transfers that specify a distribution metric)",
   360  		},
   361  		{
   362  			transfer: commandspb.Transfer{
   363  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   364  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
   365  				Kind: &commandspb.Transfer_OneOff{
   366  					OneOff: &commandspb.OneOffTransfer{},
   367  				},
   368  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   369  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   370  				Amount:    "1",
   371  				Reference: "testing",
   372  			},
   373  			errString: "transfer.account.to (transfers to metric-based reward accounts must be recurring transfers that specify a distribution metric)",
   374  		},
   375  		{
   376  			transfer: commandspb.Transfer{
   377  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   378  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD,
   379  				Kind: &commandspb.Transfer_OneOff{
   380  					OneOff: &commandspb.OneOffTransfer{},
   381  				},
   382  				To:        "0000000000000000000000000000000000000000000000000000000000000000",
   383  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   384  				Amount:    "1",
   385  				Reference: "testing",
   386  			},
   387  		},
   388  		{
   389  			transfer: commandspb.Transfer{
   390  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   391  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
   392  				Kind: &commandspb.Transfer_Recurring{
   393  					Recurring: &commandspb.RecurringTransfer{
   394  						StartEpoch: 10,
   395  						EndEpoch:   ptr.From(uint64(11)),
   396  						Factor:     "1",
   397  						DispatchStrategy: &vega.DispatchStrategy{
   398  							AssetForMetric:       "",
   399  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_LP_FEES_RECEIVED,
   400  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   401  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_TEAMS,
   402  						},
   403  					},
   404  				},
   405  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   406  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   407  				Amount:    "1",
   408  				Reference: "testing",
   409  			},
   410  			errString: "transfer.kind.dispatch_strategy.asset_for_metric (is required)",
   411  		},
   412  		{
   413  			transfer: commandspb.Transfer{
   414  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   415  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
   416  				Kind: &commandspb.Transfer_Recurring{
   417  					Recurring: &commandspb.RecurringTransfer{
   418  						StartEpoch: 10,
   419  						EndEpoch:   ptr.From(uint64(11)),
   420  						Factor:     "1",
   421  						DispatchStrategy: &vega.DispatchStrategy{
   422  							AssetForMetric:       "",
   423  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_LP_FEES_RECEIVED,
   424  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   425  						},
   426  					},
   427  				},
   428  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   429  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   430  				Amount:    "1",
   431  				Reference: "testing",
   432  			},
   433  			errString: "transfer.kind.dispatch_strategy.entity_scope (is required)",
   434  		},
   435  		{
   436  			transfer: commandspb.Transfer{
   437  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   438  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
   439  				Kind: &commandspb.Transfer_Recurring{
   440  					Recurring: &commandspb.RecurringTransfer{
   441  						StartEpoch: 10,
   442  						EndEpoch:   ptr.From(uint64(11)),
   443  						Factor:     "1",
   444  						DispatchStrategy: &vega.DispatchStrategy{
   445  							AssetForMetric:       "",
   446  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_LP_FEES_RECEIVED,
   447  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   448  							CapRewardFeeMultiple: &capInvalidNumber,
   449  						},
   450  					},
   451  				},
   452  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   453  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   454  				Amount:    "1",
   455  				Reference: "testing",
   456  			},
   457  			errString: "transfer.kind.dispatch_strategy.cap_reward_fee_multiple (is not a valid number)",
   458  		},
   459  		{
   460  			transfer: commandspb.Transfer{
   461  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   462  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
   463  				Kind: &commandspb.Transfer_Recurring{
   464  					Recurring: &commandspb.RecurringTransfer{
   465  						StartEpoch: 10,
   466  						EndEpoch:   ptr.From(uint64(11)),
   467  						Factor:     "1",
   468  						DispatchStrategy: &vega.DispatchStrategy{
   469  							AssetForMetric:       "",
   470  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_LP_FEES_RECEIVED,
   471  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   472  							CapRewardFeeMultiple: &capNegative,
   473  						},
   474  					},
   475  				},
   476  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   477  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   478  				Amount:    "1",
   479  				Reference: "testing",
   480  			},
   481  			errString: "transfer.kind.dispatch_strategy.cap_reward_fee_multiple (must be positive)",
   482  		},
   483  		{
   484  			transfer: commandspb.Transfer{
   485  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   486  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
   487  				Kind: &commandspb.Transfer_Recurring{
   488  					Recurring: &commandspb.RecurringTransfer{
   489  						StartEpoch: 10,
   490  						EndEpoch:   ptr.From(uint64(11)),
   491  						Factor:     "1",
   492  						DispatchStrategy: &vega.DispatchStrategy{
   493  							AssetForMetric:       "",
   494  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_LP_FEES_RECEIVED,
   495  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   496  							CapRewardFeeMultiple: &capZero,
   497  						},
   498  					},
   499  				},
   500  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   501  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   502  				Amount:    "1",
   503  				Reference: "testing",
   504  			},
   505  			errString: "transfer.kind.dispatch_strategy.cap_reward_fee_multiple (must be positive)",
   506  		},
   507  		{
   508  			transfer: commandspb.Transfer{
   509  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   510  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
   511  				Kind: &commandspb.Transfer_Recurring{
   512  					Recurring: &commandspb.RecurringTransfer{
   513  						StartEpoch: 10,
   514  						EndEpoch:   ptr.From(uint64(11)),
   515  						Factor:     "1",
   516  						DispatchStrategy: &vega.DispatchStrategy{
   517  							AssetForMetric:       "",
   518  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
   519  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   520  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_TEAMS,
   521  						},
   522  					},
   523  				},
   524  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   525  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   526  				Amount:    "1",
   527  				Reference: "testing",
   528  			},
   529  			errString: "transfer.kind.dispatch_strategy.entity_scope (ENTITY_SCOPE_TEAMS is not allowed for ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS)",
   530  		},
   531  		{
   532  			transfer: commandspb.Transfer{
   533  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   534  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
   535  				Kind: &commandspb.Transfer_Recurring{
   536  					Recurring: &commandspb.RecurringTransfer{
   537  						StartEpoch: 10,
   538  						EndEpoch:   ptr.From(uint64(11)),
   539  						Factor:     "1",
   540  						DispatchStrategy: &vega.DispatchStrategy{
   541  							AssetForMetric:  "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   542  							Metric:          vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
   543  							EntityScope:     vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   544  							IndividualScope: vega.IndividualScope_INDIVIDUAL_SCOPE_ALL,
   545  						},
   546  					},
   547  				},
   548  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   549  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   550  				Amount:    "1",
   551  				Reference: "testing",
   552  			},
   553  		},
   554  		{
   555  			transfer: commandspb.Transfer{
   556  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   557  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
   558  				Kind: &commandspb.Transfer_Recurring{
   559  					Recurring: &commandspb.RecurringTransfer{
   560  						StartEpoch: 10,
   561  						EndEpoch:   ptr.From(uint64(11)),
   562  						Factor:     "1",
   563  						DispatchStrategy: &vega.DispatchStrategy{
   564  							AssetForMetric:  "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   565  							Metric:          vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
   566  							EntityScope:     vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   567  							IndividualScope: vega.IndividualScope_INDIVIDUAL_SCOPE_ALL,
   568  							Markets:         []string{"market1", "market2"},
   569  						},
   570  					},
   571  				},
   572  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   573  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   574  				Amount:    "1",
   575  				Reference: "testing",
   576  			},
   577  		},
   578  		{
   579  			transfer: commandspb.Transfer{
   580  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   581  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
   582  				Kind: &commandspb.Transfer_Recurring{
   583  					Recurring: &commandspb.RecurringTransfer{
   584  						StartEpoch: 10,
   585  						EndEpoch:   ptr.From(uint64(11)),
   586  						Factor:     "1",
   587  						DispatchStrategy: &vega.DispatchStrategy{
   588  							Metric:          vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
   589  							EntityScope:     vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   590  							IndividualScope: vega.IndividualScope_INDIVIDUAL_SCOPE_ALL,
   591  							Markets:         []string{"market1", "market2"},
   592  						},
   593  					},
   594  				},
   595  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   596  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   597  				Amount:    "1",
   598  				Reference: "testing",
   599  			},
   600  		},
   601  		{
   602  			transfer: commandspb.Transfer{
   603  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   604  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
   605  				Kind: &commandspb.Transfer_Recurring{
   606  					Recurring: &commandspb.RecurringTransfer{
   607  						StartEpoch: 10,
   608  						EndEpoch:   ptr.From(uint64(11)),
   609  						Factor:     "1",
   610  						DispatchStrategy: &vega.DispatchStrategy{
   611  							Metric:          vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
   612  							EntityScope:     vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   613  							IndividualScope: vega.IndividualScope_INDIVIDUAL_SCOPE_ALL,
   614  						},
   615  					},
   616  				},
   617  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   618  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   619  				Amount:    "1",
   620  				Reference: "testing",
   621  			},
   622  		},
   623  		{
   624  			transfer: commandspb.Transfer{
   625  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   626  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES,
   627  				Kind: &commandspb.Transfer_Recurring{
   628  					Recurring: &commandspb.RecurringTransfer{
   629  						StartEpoch: 10,
   630  						EndEpoch:   ptr.From(uint64(11)),
   631  						Factor:     "1",
   632  						DispatchStrategy: &vega.DispatchStrategy{
   633  							AssetForMetric:       "",
   634  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_MAKER_FEES_PAID,
   635  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   636  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_TEAMS,
   637  						},
   638  					},
   639  				},
   640  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   641  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   642  				Amount:    "1",
   643  				Reference: "testing",
   644  			},
   645  			errString: "transfer.kind.dispatch_strategy.n_top_performers (is required)",
   646  		},
   647  		{
   648  			transfer: commandspb.Transfer{
   649  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   650  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES,
   651  				Kind: &commandspb.Transfer_Recurring{
   652  					Recurring: &commandspb.RecurringTransfer{
   653  						StartEpoch: 10,
   654  						EndEpoch:   ptr.From(uint64(11)),
   655  						Factor:     "1",
   656  						DispatchStrategy: &vega.DispatchStrategy{
   657  							AssetForMetric:       "",
   658  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_MAKER_FEES_PAID,
   659  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   660  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   661  							NTopPerformers:       "5",
   662  						},
   663  					},
   664  				},
   665  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   666  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   667  				Amount:    "1",
   668  				Reference: "testing",
   669  			},
   670  			errString: "transfer.kind.dispatch_strategy.n_top_performers (must not be set when entity scope is not ENTITY_SCOPE_TEAMS)",
   671  		},
   672  		{
   673  			transfer: commandspb.Transfer{
   674  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   675  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES,
   676  				Kind: &commandspb.Transfer_Recurring{
   677  					Recurring: &commandspb.RecurringTransfer{
   678  						StartEpoch: 10,
   679  						EndEpoch:   ptr.From(uint64(11)),
   680  						Factor:     "1",
   681  						DispatchStrategy: &vega.DispatchStrategy{
   682  							AssetForMetric:       "",
   683  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_MAKER_FEES_PAID,
   684  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   685  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_TEAMS,
   686  							NTopPerformers:       "banana",
   687  						},
   688  					},
   689  				},
   690  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   691  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   692  				Amount:    "1",
   693  				Reference: "testing",
   694  			},
   695  			errString: "transfer.kind.dispatch_strategy.n_top_performers (is not a valid number)",
   696  		},
   697  		{
   698  			transfer: commandspb.Transfer{
   699  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   700  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES,
   701  				Kind: &commandspb.Transfer_Recurring{
   702  					Recurring: &commandspb.RecurringTransfer{
   703  						StartEpoch: 10,
   704  						EndEpoch:   ptr.From(uint64(11)),
   705  						Factor:     "1",
   706  						DispatchStrategy: &vega.DispatchStrategy{
   707  							AssetForMetric:       "",
   708  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_MAKER_FEES_PAID,
   709  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   710  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_TEAMS,
   711  							NTopPerformers:       "-0.5",
   712  						},
   713  					},
   714  				},
   715  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   716  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   717  				Amount:    "1",
   718  				Reference: "testing",
   719  			},
   720  			errString: "transfer.kind.dispatch_strategy.n_top_performers (must be between 0 (excluded) and 1 (included))",
   721  		},
   722  		{
   723  			transfer: commandspb.Transfer{
   724  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   725  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES,
   726  				Kind: &commandspb.Transfer_Recurring{
   727  					Recurring: &commandspb.RecurringTransfer{
   728  						StartEpoch: 10,
   729  						EndEpoch:   ptr.From(uint64(11)),
   730  						Factor:     "1",
   731  						DispatchStrategy: &vega.DispatchStrategy{
   732  							AssetForMetric:       "",
   733  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_MAKER_FEES_PAID,
   734  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   735  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_TEAMS,
   736  							NTopPerformers:       "1.1",
   737  						},
   738  					},
   739  				},
   740  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   741  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   742  				Amount:    "1",
   743  				Reference: "testing",
   744  			},
   745  			errString: "transfer.kind.dispatch_strategy.n_top_performers (must be between 0 (excluded) and 1 (included))",
   746  		},
   747  		{
   748  			transfer: commandspb.Transfer{
   749  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   750  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_VALIDATOR_RANKING,
   751  				Kind: &commandspb.Transfer_Recurring{
   752  					Recurring: &commandspb.RecurringTransfer{
   753  						StartEpoch: 10,
   754  						EndEpoch:   ptr.From(uint64(11)),
   755  						Factor:     "1",
   756  						DispatchStrategy: &vega.DispatchStrategy{
   757  							AssetForMetric:       "",
   758  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_VALIDATOR_RANKING,
   759  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   760  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   761  						},
   762  					},
   763  				},
   764  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   765  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   766  				Amount:    "1",
   767  				Reference: "testing",
   768  			},
   769  			errString: "transfer.kind.dispatch_strategy.individual_scope (is required)",
   770  		},
   771  		{
   772  			transfer: commandspb.Transfer{
   773  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   774  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
   775  				Kind: &commandspb.Transfer_Recurring{
   776  					Recurring: &commandspb.RecurringTransfer{
   777  						StartEpoch: 10,
   778  						EndEpoch:   ptr.From(uint64(11)),
   779  						Factor:     "1",
   780  						DispatchStrategy: &vega.DispatchStrategy{
   781  							AssetForMetric:       "",
   782  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_LP_FEES_RECEIVED,
   783  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
   784  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_TEAMS,
   785  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_ALL,
   786  						},
   787  					},
   788  				},
   789  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   790  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   791  				Amount:    "1",
   792  				Reference: "testing",
   793  			},
   794  			errString: "transfer.kind.dispatch_strategy.individual_scope (should not be set when entity_scope is set to ENTITY_SCOPE_TEAMS)",
   795  		},
   796  		{
   797  			transfer: commandspb.Transfer{
   798  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   799  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
   800  				Kind: &commandspb.Transfer_Recurring{
   801  					Recurring: &commandspb.RecurringTransfer{
   802  						StartEpoch: 10,
   803  						EndEpoch:   ptr.From(uint64(11)),
   804  						Factor:     "1",
   805  						DispatchStrategy: &vega.DispatchStrategy{
   806  							AssetForMetric:  "",
   807  							Metric:          vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
   808  							EntityScope:     vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   809  							IndividualScope: vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
   810  						},
   811  					},
   812  				},
   813  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   814  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   815  				Amount:    "1",
   816  				Reference: "testing",
   817  			},
   818  			errString: "transfer.kind.dispatch_strategy.distribution_strategy (is required)",
   819  		},
   820  		{
   821  			transfer: commandspb.Transfer{
   822  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   823  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
   824  				Kind: &commandspb.Transfer_Recurring{
   825  					Recurring: &commandspb.RecurringTransfer{
   826  						StartEpoch: 10,
   827  						EndEpoch:   ptr.From(uint64(11)),
   828  						Factor:     "1",
   829  						DispatchStrategy: &vega.DispatchStrategy{
   830  							AssetForMetric:       "",
   831  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
   832  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   833  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
   834  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_RANK,
   835  						},
   836  					},
   837  				},
   838  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   839  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   840  				Amount:    "1",
   841  				Reference: "testing",
   842  			},
   843  			errString: "transfer.kind.dispatch_strategy.distribution_strategy (should not be set when to_account is set to ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS)",
   844  		},
   845  		{
   846  			transfer: commandspb.Transfer{
   847  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   848  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
   849  				Kind: &commandspb.Transfer_Recurring{
   850  					Recurring: &commandspb.RecurringTransfer{
   851  						StartEpoch: 10,
   852  						EndEpoch:   ptr.From(uint64(11)),
   853  						Factor:     "1",
   854  						DispatchStrategy: &vega.DispatchStrategy{
   855  							AssetForMetric:     "",
   856  							Metric:             vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
   857  							EntityScope:        vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   858  							IndividualScope:    vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
   859  							StakingRequirement: "banana",
   860  						},
   861  					},
   862  				},
   863  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   864  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   865  				Amount:    "1",
   866  				Reference: "testing",
   867  			},
   868  			errString: "transfer.kind.dispatch_strategy.staking_requirement (not a valid integer)",
   869  		},
   870  		{
   871  			transfer: commandspb.Transfer{
   872  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   873  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
   874  				Kind: &commandspb.Transfer_Recurring{
   875  					Recurring: &commandspb.RecurringTransfer{
   876  						StartEpoch: 10,
   877  						EndEpoch:   ptr.From(uint64(11)),
   878  						Factor:     "1",
   879  						DispatchStrategy: &vega.DispatchStrategy{
   880  							AssetForMetric:     "",
   881  							Metric:             vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
   882  							EntityScope:        vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   883  							IndividualScope:    vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
   884  							StakingRequirement: "-1",
   885  						},
   886  					},
   887  				},
   888  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   889  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   890  				Amount:    "1",
   891  				Reference: "testing",
   892  			},
   893  			errString: "transfer.kind.dispatch_strategy.staking_requirement (must be positive or zero)",
   894  		},
   895  		{
   896  			transfer: commandspb.Transfer{
   897  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   898  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
   899  				Kind: &commandspb.Transfer_Recurring{
   900  					Recurring: &commandspb.RecurringTransfer{
   901  						StartEpoch: 10,
   902  						EndEpoch:   ptr.From(uint64(11)),
   903  						Factor:     "1",
   904  						DispatchStrategy: &vega.DispatchStrategy{
   905  							AssetForMetric:     "",
   906  							Metric:             vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
   907  							EntityScope:        vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   908  							IndividualScope:    vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
   909  							StakingRequirement: "1",
   910  						},
   911  					},
   912  				},
   913  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   914  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   915  				Amount:    "1",
   916  				Reference: "testing",
   917  			},
   918  			errString: "transfer.kind.dispatch_strategy.staking_requirement (should not be set if to_account is set to ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS)",
   919  		},
   920  		{
   921  			transfer: commandspb.Transfer{
   922  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   923  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
   924  				Kind: &commandspb.Transfer_Recurring{
   925  					Recurring: &commandspb.RecurringTransfer{
   926  						StartEpoch: 10,
   927  						EndEpoch:   ptr.From(uint64(11)),
   928  						Factor:     "1",
   929  						DispatchStrategy: &vega.DispatchStrategy{
   930  							AssetForMetric:     "",
   931  							Metric:             vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
   932  							EntityScope:        vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   933  							IndividualScope:    vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
   934  							StakingRequirement: "1",
   935  							NotionalTimeWeightedAveragePositionRequirement: "banana",
   936  						},
   937  					},
   938  				},
   939  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   940  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   941  				Amount:    "1",
   942  				Reference: "testing",
   943  			},
   944  			errString: "transfer.kind.dispatch_strategy.notional_time_weighted_average_position_requirement (not a valid integer)",
   945  		},
   946  		{
   947  			transfer: commandspb.Transfer{
   948  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   949  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
   950  				Kind: &commandspb.Transfer_Recurring{
   951  					Recurring: &commandspb.RecurringTransfer{
   952  						StartEpoch: 10,
   953  						EndEpoch:   ptr.From(uint64(11)),
   954  						Factor:     "1",
   955  						DispatchStrategy: &vega.DispatchStrategy{
   956  							AssetForMetric:  "",
   957  							Metric:          vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
   958  							EntityScope:     vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   959  							IndividualScope: vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
   960  							NotionalTimeWeightedAveragePositionRequirement: "-1",
   961  						},
   962  					},
   963  				},
   964  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   965  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   966  				Amount:    "1",
   967  				Reference: "testing",
   968  			},
   969  			errString: "transfer.kind.dispatch_strategy.notional_time_weighted_average_position_requirement (must be positive or zero)",
   970  		},
   971  		{
   972  			transfer: commandspb.Transfer{
   973  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   974  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
   975  				Kind: &commandspb.Transfer_Recurring{
   976  					Recurring: &commandspb.RecurringTransfer{
   977  						StartEpoch: 10,
   978  						EndEpoch:   ptr.From(uint64(11)),
   979  						Factor:     "1",
   980  						DispatchStrategy: &vega.DispatchStrategy{
   981  							AssetForMetric:  "",
   982  							Metric:          vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
   983  							EntityScope:     vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
   984  							IndividualScope: vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
   985  							NotionalTimeWeightedAveragePositionRequirement: "1",
   986  						},
   987  					},
   988  				},
   989  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
   990  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
   991  				Amount:    "1",
   992  				Reference: "testing",
   993  			},
   994  			errString: "transfer.kind.dispatch_strategy.notional_time_weighted_average_position_requirement (should not be set if to_account is set to ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS)",
   995  		},
   996  		{
   997  			transfer: commandspb.Transfer{
   998  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
   999  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
  1000  				Kind: &commandspb.Transfer_Recurring{
  1001  					Recurring: &commandspb.RecurringTransfer{
  1002  						StartEpoch: 10,
  1003  						EndEpoch:   ptr.From(uint64(11)),
  1004  						Factor:     "1",
  1005  						DispatchStrategy: &vega.DispatchStrategy{
  1006  							AssetForMetric:  "",
  1007  							Metric:          vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
  1008  							EntityScope:     vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1009  							IndividualScope: vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1010  							WindowLength:    10,
  1011  						},
  1012  					},
  1013  				},
  1014  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1015  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1016  				Amount:    "1",
  1017  				Reference: "testing",
  1018  			},
  1019  			errString: "transfer.kind.dispatch_strategy.window_length (should not be set for ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS)",
  1020  		},
  1021  		{
  1022  			transfer: commandspb.Transfer{
  1023  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1024  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1025  				Kind: &commandspb.Transfer_Recurring{
  1026  					Recurring: &commandspb.RecurringTransfer{
  1027  						StartEpoch: 10,
  1028  						EndEpoch:   ptr.From(uint64(11)),
  1029  						Factor:     "1",
  1030  						DispatchStrategy: &vega.DispatchStrategy{
  1031  							AssetForMetric:  "",
  1032  							Metric:          vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1033  							EntityScope:     vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1034  							IndividualScope: vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1035  							WindowLength:    101,
  1036  						},
  1037  					},
  1038  				},
  1039  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1040  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1041  				Amount:    "1",
  1042  				Reference: "testing",
  1043  			},
  1044  			errString: "transfer.kind.dispatch_strategy.window_length (must be at most 100)",
  1045  		},
  1046  		{
  1047  			transfer: commandspb.Transfer{
  1048  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1049  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1050  				Kind: &commandspb.Transfer_Recurring{
  1051  					Recurring: &commandspb.RecurringTransfer{
  1052  						StartEpoch: 10,
  1053  						EndEpoch:   ptr.From(uint64(11)),
  1054  						Factor:     "1",
  1055  						DispatchStrategy: &vega.DispatchStrategy{
  1056  							AssetForMetric:       "",
  1057  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1058  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1059  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1060  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_RANK,
  1061  						},
  1062  					},
  1063  				},
  1064  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1065  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1066  				Amount:    "1",
  1067  				Reference: "testing",
  1068  			},
  1069  			errString: "transfer.kind.dispatch_strategy.rank_table (must be positive)",
  1070  		},
  1071  		{
  1072  			transfer: commandspb.Transfer{
  1073  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1074  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1075  				Kind: &commandspb.Transfer_Recurring{
  1076  					Recurring: &commandspb.RecurringTransfer{
  1077  						StartEpoch: 10,
  1078  						EndEpoch:   ptr.From(uint64(11)),
  1079  						Factor:     "1",
  1080  						DispatchStrategy: &vega.DispatchStrategy{
  1081  							AssetForMetric:       "",
  1082  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1083  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1084  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1085  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
  1086  							RankTable: []*vega.Rank{
  1087  								{StartRank: 1, ShareRatio: 10},
  1088  							},
  1089  						},
  1090  					},
  1091  				},
  1092  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1093  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1094  				Amount:    "1",
  1095  				Reference: "testing",
  1096  			},
  1097  			errString: "transfer.kind.dispatch_strategy.rank_table (should not be set for distribution strategy DISTRIBUTION_STRATEGY_PRO_RATA)",
  1098  		},
  1099  		{
  1100  			transfer: commandspb.Transfer{
  1101  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1102  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1103  				Kind: &commandspb.Transfer_Recurring{
  1104  					Recurring: &commandspb.RecurringTransfer{
  1105  						StartEpoch: 10,
  1106  						EndEpoch:   ptr.From(uint64(11)),
  1107  						Factor:     "1",
  1108  						DispatchStrategy: &vega.DispatchStrategy{
  1109  							AssetForMetric:       "",
  1110  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1111  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1112  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1113  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_RANK,
  1114  							RankTable:            largeRankTable,
  1115  						},
  1116  					},
  1117  				},
  1118  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1119  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1120  				Amount:    "1",
  1121  				Reference: "testing",
  1122  			},
  1123  			errString: "transfer.kind.dispatch_strategy.rank_table (must be at most 500)",
  1124  		},
  1125  		{
  1126  			transfer: commandspb.Transfer{
  1127  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1128  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1129  				Kind: &commandspb.Transfer_Recurring{
  1130  					Recurring: &commandspb.RecurringTransfer{
  1131  						StartEpoch: 10,
  1132  						EndEpoch:   ptr.From(uint64(11)),
  1133  						Factor:     "1",
  1134  						DispatchStrategy: &vega.DispatchStrategy{
  1135  							AssetForMetric:       "",
  1136  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1137  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1138  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1139  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_RANK,
  1140  							RankTable: []*vega.Rank{
  1141  								{StartRank: 1, ShareRatio: 10},
  1142  								{StartRank: 3, ShareRatio: 5},
  1143  								{StartRank: 2, ShareRatio: 2},
  1144  							},
  1145  						},
  1146  					},
  1147  				},
  1148  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1149  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1150  				Amount:    "1",
  1151  				Reference: "testing",
  1152  			},
  1153  			errString: "transfer.kind.dispatch_strategy.rank_table.%!i(int=2).start_rank (must be greater than start_rank of element #1)",
  1154  		},
  1155  		{
  1156  			transfer: commandspb.Transfer{
  1157  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1158  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1159  				Kind: &commandspb.Transfer_Recurring{
  1160  					Recurring: &commandspb.RecurringTransfer{
  1161  						StartEpoch: 10,
  1162  						EndEpoch:   ptr.From(uint64(11)),
  1163  						Factor:     "1",
  1164  						DispatchStrategy: &vega.DispatchStrategy{
  1165  							AssetForMetric:       "",
  1166  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1167  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1168  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1169  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_RANK,
  1170  							RankTable: []*vega.Rank{
  1171  								{StartRank: 1, ShareRatio: 10},
  1172  								{StartRank: 2, ShareRatio: 5},
  1173  								{StartRank: 2, ShareRatio: 2},
  1174  							},
  1175  						},
  1176  					},
  1177  				},
  1178  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1179  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1180  				Amount:    "1",
  1181  				Reference: "testing",
  1182  			},
  1183  			errString: "transfer.kind.dispatch_strategy.rank_table.%!i(int=2).start_rank (must be greater than start_rank of element #1)",
  1184  		},
  1185  		{
  1186  			transfer: commandspb.Transfer{
  1187  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1188  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1189  				Kind: &commandspb.Transfer_Recurring{
  1190  					Recurring: &commandspb.RecurringTransfer{
  1191  						StartEpoch: 10,
  1192  						EndEpoch:   ptr.From(uint64(11)),
  1193  						Factor:     "1",
  1194  						DispatchStrategy: &vega.DispatchStrategy{
  1195  							AssetForMetric:       "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1196  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1197  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
  1198  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1199  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1200  							StakingRequirement:   "1",
  1201  							NotionalTimeWeightedAveragePositionRequirement: "2",
  1202  							WindowLength: 0,
  1203  						},
  1204  					},
  1205  				},
  1206  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1207  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1208  				Amount:    "1",
  1209  				Reference: "testing",
  1210  			},
  1211  			errString: "transfer.kind.dispatch_strategy.window_length (must be between 1 and 100)",
  1212  		},
  1213  		{
  1214  			transfer: commandspb.Transfer{
  1215  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1216  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1217  				Kind: &commandspb.Transfer_Recurring{
  1218  					Recurring: &commandspb.RecurringTransfer{
  1219  						StartEpoch: 10,
  1220  						EndEpoch:   ptr.From(uint64(11)),
  1221  						Factor:     "1",
  1222  						DispatchStrategy: &vega.DispatchStrategy{
  1223  							AssetForMetric:       "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1224  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1225  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
  1226  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1227  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1228  							StakingRequirement:   "1",
  1229  							NotionalTimeWeightedAveragePositionRequirement: "2",
  1230  							WindowLength: 1,
  1231  						},
  1232  					},
  1233  				},
  1234  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1235  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1236  				Amount:    "1",
  1237  				Reference: "testing",
  1238  			},
  1239  		},
  1240  		{
  1241  			transfer: commandspb.Transfer{
  1242  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1243  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1244  				Kind: &commandspb.Transfer_Recurring{
  1245  					Recurring: &commandspb.RecurringTransfer{
  1246  						StartEpoch: 10,
  1247  						EndEpoch:   ptr.From(uint64(11)),
  1248  						Factor:     "1",
  1249  						DispatchStrategy: &vega.DispatchStrategy{
  1250  							AssetForMetric:       "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1251  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1252  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
  1253  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1254  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1255  							TeamScope:            []string{"zohafr"},
  1256  							StakingRequirement:   "1",
  1257  							NotionalTimeWeightedAveragePositionRequirement: "2",
  1258  							WindowLength: 1,
  1259  						},
  1260  					},
  1261  				},
  1262  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1263  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1264  				Amount:    "1",
  1265  				Reference: "testing",
  1266  			},
  1267  			errString: "transfer.kind.dispatch_strategy.team_scope (should not be set when entity_scope is set to ENTITY_SCOPE_INDIVIDUALS)",
  1268  		},
  1269  		{
  1270  			transfer: commandspb.Transfer{
  1271  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_VESTED_REWARDS,
  1272  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_MARGIN,
  1273  				Kind: &commandspb.Transfer_Recurring{
  1274  					Recurring: &commandspb.RecurringTransfer{},
  1275  				},
  1276  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1277  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1278  				Amount:    "1000",
  1279  				Reference: "testing",
  1280  			},
  1281  			errString: "transfer.from_account_type (account type is not valid for one recurring transfer",
  1282  		},
  1283  		{
  1284  			transfer: commandspb.Transfer{
  1285  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1286  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1287  				Kind: &commandspb.Transfer_Recurring{
  1288  					Recurring: &commandspb.RecurringTransfer{
  1289  						StartEpoch: 10,
  1290  						EndEpoch:   ptr.From(uint64(11)),
  1291  						Factor:     "1",
  1292  						DispatchStrategy: &vega.DispatchStrategy{
  1293  							AssetForMetric:       "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1294  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1295  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
  1296  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_TEAMS,
  1297  							TeamScope:            []string{"team1"},
  1298  							StakingRequirement:   "1",
  1299  							NotionalTimeWeightedAveragePositionRequirement: "2",
  1300  							WindowLength:   1,
  1301  							NTopPerformers: "0.5",
  1302  						},
  1303  					},
  1304  				},
  1305  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1306  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1307  				Amount:    "1",
  1308  				Reference: "testing",
  1309  			},
  1310  		},
  1311  		{
  1312  			transfer: commandspb.Transfer{
  1313  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1314  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1315  				Kind: &commandspb.Transfer_Recurring{
  1316  					Recurring: &commandspb.RecurringTransfer{
  1317  						StartEpoch: 10,
  1318  						EndEpoch:   ptr.From(uint64(11)),
  1319  						Factor:     "1",
  1320  						DispatchStrategy: &vega.DispatchStrategy{
  1321  							AssetForMetric:   "",
  1322  							Metric:           vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1323  							EntityScope:      vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1324  							IndividualScope:  vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1325  							WindowLength:     100,
  1326  							TransferInterval: &tooLongTransferInterval,
  1327  						},
  1328  					},
  1329  				},
  1330  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1331  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1332  				Amount:    "1",
  1333  				Reference: "testing",
  1334  			},
  1335  			errString: "transfer.kind.dispatch_strategy.transfer_interval (must be between 1 and 100)",
  1336  		},
  1337  		{
  1338  			transfer: commandspb.Transfer{
  1339  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1340  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1341  				Kind: &commandspb.Transfer_Recurring{
  1342  					Recurring: &commandspb.RecurringTransfer{
  1343  						StartEpoch: 10,
  1344  						EndEpoch:   ptr.From(uint64(11)),
  1345  						Factor:     "1",
  1346  						DispatchStrategy: &vega.DispatchStrategy{
  1347  							AssetForMetric:   "",
  1348  							Metric:           vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1349  							EntityScope:      vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1350  							IndividualScope:  vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1351  							WindowLength:     100,
  1352  							TransferInterval: &zeroTransferInterval,
  1353  						},
  1354  					},
  1355  				},
  1356  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1357  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1358  				Amount:    "1",
  1359  				Reference: "testing",
  1360  			},
  1361  			errString: "transfer.kind.dispatch_strategy.transfer_interval (must be between 1 and 100)",
  1362  		},
  1363  		{
  1364  			transfer: commandspb.Transfer{
  1365  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1366  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1367  				Kind: &commandspb.Transfer_Recurring{
  1368  					Recurring: &commandspb.RecurringTransfer{
  1369  						StartEpoch: 10,
  1370  						EndEpoch:   ptr.From(uint64(11)),
  1371  						Factor:     "1",
  1372  						DispatchStrategy: &vega.DispatchStrategy{
  1373  							AssetForMetric:   "",
  1374  							Metric:           vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1375  							EntityScope:      vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1376  							IndividualScope:  vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1377  							WindowLength:     100,
  1378  							TransferInterval: &negativeTransferInterval,
  1379  						},
  1380  					},
  1381  				},
  1382  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1383  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1384  				Amount:    "1",
  1385  				Reference: "testing",
  1386  			},
  1387  			errString: "transfer.kind.dispatch_strategy.transfer_interval (must be between 1 and 100)",
  1388  		},
  1389  		// sub account type tests
  1390  		{
  1391  			transfer: commandspb.Transfer{
  1392  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_VESTED_REWARDS,
  1393  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1394  				From:            toPointer("derived_key"),
  1395  				Kind: &commandspb.Transfer_OneOff{
  1396  					OneOff: &commandspb.OneOffTransfer{},
  1397  				},
  1398  				To:        "0000000000000000000000000000000000000000000000000000000000000000",
  1399  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1400  				Amount:    "1",
  1401  				Reference: "testing",
  1402  			},
  1403  			errString: "transfer.from (should be a valid vega public key)",
  1404  		},
  1405  		{
  1406  			transfer: commandspb.Transfer{
  1407  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1408  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1409  				From:            toPointer("171538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff"),
  1410  				Kind: &commandspb.Transfer_OneOff{
  1411  					OneOff: &commandspb.OneOffTransfer{},
  1412  				},
  1413  				To:        "0000000000000000000000000000000000000000000000000000000000000000",
  1414  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1415  				Amount:    "1",
  1416  				Reference: "testing",
  1417  			},
  1418  			errString: "transfer.from (from can only be set for vested rewards)",
  1419  		},
  1420  		{
  1421  			transfer: commandspb.Transfer{
  1422  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_VESTED_REWARDS,
  1423  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD,
  1424  				From:            toPointer("171538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff"),
  1425  				Kind: &commandspb.Transfer_OneOff{
  1426  					OneOff: &commandspb.OneOffTransfer{},
  1427  				},
  1428  				To:        "0000000000000000000000000000000000000000000000000000000000000000",
  1429  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1430  				Amount:    "1",
  1431  				Reference: "testing",
  1432  			},
  1433  			errString: "transfer.from (from can only be set when transferring to general account)",
  1434  		},
  1435  		{
  1436  			transfer: commandspb.Transfer{
  1437  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_VESTED_REWARDS,
  1438  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1439  				From:            toPointer("171538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff"),
  1440  				Kind: &commandspb.Transfer_OneOff{
  1441  					OneOff: &commandspb.OneOffTransfer{},
  1442  				},
  1443  				To:        "0000000000000000000000000000000000000000000000000000000000000000",
  1444  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1445  				Amount:    "1",
  1446  				Reference: "testing",
  1447  			},
  1448  		},
  1449  		{
  1450  			transfer: commandspb.Transfer{
  1451  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1452  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1453  				Kind: &commandspb.Transfer_Recurring{
  1454  					Recurring: &commandspb.RecurringTransfer{
  1455  						StartEpoch: 10,
  1456  						EndEpoch:   ptr.From(uint64(11)),
  1457  						Factor:     "1",
  1458  						DispatchStrategy: &vega.DispatchStrategy{
  1459  							AssetForMetric:       "",
  1460  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1461  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1462  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1463  							WindowLength:         100,
  1464  							TransferInterval:     &tooLongTransferInterval,
  1465  							TargetNotionalVolume: &notionalVolumeInvalidNumber,
  1466  						},
  1467  					},
  1468  				},
  1469  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1470  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1471  				Amount:    "1",
  1472  				Reference: "testing",
  1473  			},
  1474  			errString: "transfer.kind.dispatch_strategy.target_notional_volume (is not a valid number)",
  1475  		},
  1476  		{
  1477  			transfer: commandspb.Transfer{
  1478  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1479  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1480  				Kind: &commandspb.Transfer_Recurring{
  1481  					Recurring: &commandspb.RecurringTransfer{
  1482  						StartEpoch: 10,
  1483  						EndEpoch:   ptr.From(uint64(11)),
  1484  						Factor:     "1",
  1485  						DispatchStrategy: &vega.DispatchStrategy{
  1486  							AssetForMetric:       "",
  1487  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1488  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1489  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1490  							WindowLength:         100,
  1491  							TransferInterval:     &tooLongTransferInterval,
  1492  							TargetNotionalVolume: &notionalVolumeNegative,
  1493  						},
  1494  					},
  1495  				},
  1496  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1497  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1498  				Amount:    "1",
  1499  				Reference: "testing",
  1500  			},
  1501  			errString: "transfer.kind.dispatch_strategy.target_notional_volume (must be positive)",
  1502  		},
  1503  		{
  1504  			transfer: commandspb.Transfer{
  1505  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1506  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1507  				Kind: &commandspb.Transfer_Recurring{
  1508  					Recurring: &commandspb.RecurringTransfer{
  1509  						StartEpoch: 10,
  1510  						EndEpoch:   ptr.From(uint64(11)),
  1511  						Factor:     "1",
  1512  						DispatchStrategy: &vega.DispatchStrategy{
  1513  							AssetForMetric:       "",
  1514  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_AVERAGE_NOTIONAL,
  1515  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1516  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1517  							WindowLength:         100,
  1518  							TransferInterval:     &tooLongTransferInterval,
  1519  							TargetNotionalVolume: &notionalVolumeZero,
  1520  						},
  1521  					},
  1522  				},
  1523  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1524  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1525  				Amount:    "1",
  1526  				Reference: "testing",
  1527  			},
  1528  			errString: "transfer.kind.dispatch_strategy.target_notional_volume (must be positive)",
  1529  		},
  1530  		{
  1531  			transfer: commandspb.Transfer{
  1532  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1533  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
  1534  				Kind: &commandspb.Transfer_Recurring{
  1535  					Recurring: &commandspb.RecurringTransfer{
  1536  						StartEpoch: 10,
  1537  						EndEpoch:   ptr.From(uint64(11)),
  1538  						Factor:     "1",
  1539  						DispatchStrategy: &vega.DispatchStrategy{
  1540  							AssetForMetric:       "",
  1541  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_MARKET_VALUE,
  1542  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1543  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1544  							WindowLength:         100,
  1545  							TransferInterval:     &tooLongTransferInterval,
  1546  							TargetNotionalVolume: &notionalVolumeValid,
  1547  						},
  1548  					},
  1549  				},
  1550  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1551  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1552  				Amount:    "1",
  1553  				Reference: "testing",
  1554  			},
  1555  			errString: "transfer.kind.dispatch_strategy.target_notional_volume (not allowed for metric DISPATCH_METRIC_MARKET_VALUE)",
  1556  		},
  1557  		{
  1558  			transfer: commandspb.Transfer{
  1559  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1560  				ToAccountType:   vega.AccountType_ACCOUNT_TYPE_REWARD_ELIGIBLE_ENTITIES,
  1561  				Kind: &commandspb.Transfer_Recurring{
  1562  					Recurring: &commandspb.RecurringTransfer{
  1563  						StartEpoch: 10,
  1564  						EndEpoch:   ptr.From(uint64(11)),
  1565  						Factor:     "1",
  1566  						DispatchStrategy: &vega.DispatchStrategy{
  1567  							AssetForMetric:       "",
  1568  							Metric:               vega.DispatchMetric_DISPATCH_METRIC_ELIGIBLE_ENTITIES,
  1569  							EntityScope:          vega.EntityScope_ENTITY_SCOPE_INDIVIDUALS,
  1570  							IndividualScope:      vega.IndividualScope_INDIVIDUAL_SCOPE_IN_TEAM,
  1571  							WindowLength:         100,
  1572  							TransferInterval:     &tooLongTransferInterval,
  1573  							DistributionStrategy: vega.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA,
  1574  							// no asset for metric, no markets in scope, no position requirement, no staking requirement
  1575  						},
  1576  					},
  1577  				},
  1578  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1579  				Asset:     "080538b7cc2249de568cb4272a17f4d5e0b0a69a1a240acbf5119d816178daff",
  1580  				Amount:    "1",
  1581  				Reference: "testing",
  1582  			},
  1583  			errString: "transfer.kind.dispatch_strategy.dispatch_metric (eligible_entities metric requires at least one of (markets, asset_for_metric, staking_requirement, notional_time_weighted_average_position_requirement) to be defined)",
  1584  		},
  1585  	}
  1586  
  1587  	invalidAccountTypesForOneOff := []vega.AccountType{
  1588  		vega.AccountType_ACCOUNT_TYPE_INSURANCE,
  1589  		vega.AccountType_ACCOUNT_TYPE_SETTLEMENT,
  1590  		vega.AccountType_ACCOUNT_TYPE_MARGIN,
  1591  		vega.AccountType_ACCOUNT_TYPE_FEES_INFRASTRUCTURE,
  1592  		vega.AccountType_ACCOUNT_TYPE_FEES_LIQUIDITY,
  1593  		vega.AccountType_ACCOUNT_TYPE_FEES_MAKER,
  1594  		vega.AccountType_ACCOUNT_TYPE_BOND,
  1595  		vega.AccountType_ACCOUNT_TYPE_EXTERNAL,
  1596  		vega.AccountType_ACCOUNT_TYPE_GLOBAL_INSURANCE,
  1597  		vega.AccountType_ACCOUNT_TYPE_PENDING_TRANSFERS,
  1598  		vega.AccountType_ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES,
  1599  		vega.AccountType_ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES,
  1600  		vega.AccountType_ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS,
  1601  		vega.AccountType_ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES,
  1602  		vega.AccountType_ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL,
  1603  		vega.AccountType_ACCOUNT_TYPE_REWARD_RELATIVE_RETURN,
  1604  		vega.AccountType_ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY,
  1605  		vega.AccountType_ACCOUNT_TYPE_REWARD_VALIDATOR_RANKING,
  1606  		vega.AccountType_ACCOUNT_TYPE_REWARD_REALISED_RETURN,
  1607  	}
  1608  
  1609  	for _, at := range invalidAccountTypesForOneOff {
  1610  		cases = append(cases, struct {
  1611  			transfer  commandspb.Transfer
  1612  			errString string
  1613  		}{
  1614  			transfer: commandspb.Transfer{
  1615  				FromAccountType: vega.AccountType_ACCOUNT_TYPE_GENERAL,
  1616  				ToAccountType:   at,
  1617  				Kind: &commandspb.Transfer_OneOff{
  1618  					OneOff: &commandspb.OneOffTransfer{},
  1619  				},
  1620  				To:        "84e2b15102a8d6c1c6b4bdf40af8a0dc21b040eaaa1c94cd10d17604b75fdc35",
  1621  				Asset:     "",
  1622  				Amount:    "1",
  1623  				Reference: "testing",
  1624  			},
  1625  			errString: "transfer.to_account_type (account type is not valid for one off transfer)",
  1626  		})
  1627  	}
  1628  
  1629  	for _, c := range cases {
  1630  		err := commands.CheckTransfer(&c.transfer)
  1631  		if len(c.errString) <= 0 {
  1632  			assert.NoError(t, err, c.transfer.String())
  1633  			continue
  1634  		}
  1635  		assert.Contains(t, err.Error(), c.errString)
  1636  	}
  1637  }
  1638  
  1639  func checkTransfer(cmd *commandspb.Transfer) commands.Errors {
  1640  	err := commands.CheckTransfer(cmd)
  1641  
  1642  	var e commands.Errors
  1643  	if ok := errors.As(err, &e); !ok {
  1644  		return commands.NewErrors()
  1645  	}
  1646  
  1647  	return e
  1648  }
  1649  
  1650  func toPointer[T any](val T) *T {
  1651  	return &val
  1652  }