code.vegaprotocol.io/vega@v0.79.0/core/integration/features/transfers/recurring_transfers.feature (about)

     1  Feature: Test one off transfers
     2  
     3  Background:
     4      Given time is updated to "2021-08-26T00:00:00Z"
     5      Given the following network parameters are set:
     6        | name                                    | value |
     7        | transfer.fee.factor                     | 0.5   |
     8        | validators.epoch.length                 | 10s   |
     9        | transfer.minTransferQuantumMultiple     | 0.01  |
    10        | network.markPriceUpdateMaximumFrequency | 0s    |
    11        | transfer.fee.maxQuantumAmount           |  1    |
    12  
    13      
    14      Given the following assets are updated:
    15      | id    | decimal places | quantum  |
    16      | VEGA  |       0        |   50000  |
    17  
    18      Given the parties deposit on asset's general account the following amount:
    19      | party    | asset | amount          |
    20      | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c   | VEGA  | 10000000        |
    21  
    22      Then time is updated to "2021-08-26T00:00:12Z"
    23      Given the average block duration is "2"
    24  
    25  Scenario: simple successful recurring transfers
    26      Given the parties submit the following recurring transfers:
    27      | id | from                                                             | from_account_type    | to                                                               | to_account_type      | asset | amount | start_epoch | end_epoch | factor |
    28      | 1  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | VEGA  | 10000  | 1           |           | 0.5    |
    29      | 2  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL | 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 | ACCOUNT_TYPE_GENERAL | VEGA  | 20000  | 2           | 3         | 0.2    |
    30  
    31      # end of epoch 1 - transferring 10k from f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c to a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 + 5000 fees
    32      When the network moves ahead "14" blocks
    33      Then "f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c" should have general account balance of "9985000" for asset "VEGA"
    34      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "10000" for asset "VEGA"
    35  
    36      # end of epoch 2
    37      # transferring 5k from f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c to a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 + 2500 fees
    38      # transferring 20k from f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c to 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 + 10k fees
    39      When the network moves ahead "7" blocks
    40      Then "f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c" should have general account balance of "9947500" for asset "VEGA"
    41      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "15000" for asset "VEGA"
    42      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "20000" for asset "VEGA"
    43  
    44      # end of epoch 3
    45      # transferring 2.5k from f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c to a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 + 1250 fees
    46      # transferring 4k from f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c to 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 + 2k fees
    47      When the network moves ahead "7" blocks
    48      Then "f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c" should have general account balance of "9937750" for asset "VEGA"
    49      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "17500" for asset "VEGA"
    50      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "24000" for asset "VEGA"
    51  
    52      # end of epoch 4
    53      # transferring 1250 from f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c to a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 + 625 fees
    54      When the network moves ahead "7" blocks
    55      Then "f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c" should have general account balance of "9935875" for asset "VEGA"
    56      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "18750" for asset "VEGA"
    57      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "24000" for asset "VEGA"
    58  
    59      When the parties submit the following transfer cancellations:
    60      | party  | transfer_id |
    61      | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c |      1      |
    62  
    63      When the network moves ahead "7" blocks
    64      Then "f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c" should have general account balance of "9935875" for asset "VEGA"
    65      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "18750" for asset "VEGA"
    66      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "24000" for asset "VEGA"
    67  
    68  Scenario: invalid recurring transfers
    69      Given the parties submit the following recurring transfers:
    70      | id | from                                                             | from_account_type                       | to                                                               | to_account_type                  | asset | amount | start_epoch | end_epoch | factor | error                         |
    71      | 1  |                                                                  | ACCOUNT_TYPE_GENERAL                    | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | invalid from account          |
    72      | 2  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    |                                                                  | ACCOUNT_TYPE_GENERAL             | VEGA  | 20000  | 1           |           | 0.5    | invalid to account            |
    73      | 3  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 0      | 1           |           | 0.5    | cannot transfer zero funds    |
    74      | 4  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_UNSPECIFIED                | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    75      | 5  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_INSURANCE                  | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    76      | 6  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_SETTLEMENT                 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    77      | 7  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_MARGIN                     | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    78      | 8  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_FEES_INFRASTRUCTURE        | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    79      | 9  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_FEES_LIQUIDITY             | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    80      | 10 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_FEES_MAKER                 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    81      | 11 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_LOCK_WITHDRAW              | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    82      | 12 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_BOND                       | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    83      | 13 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_EXTERNAL                   | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    84      | 14 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GLOBAL_INSURANCE           | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    85      | 15 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GLOBAL_REWARD              | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    86      | 16 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_PENDING_TRANSFERS          | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    87      | 17 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES     | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    88      | 18 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    89      | 19 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    90      | 20 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           |           | 0.5    | unsupported from account type |
    91      | 21 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_UNSPECIFIED         | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
    92      | 22 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_INSURANCE           | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
    93      | 23 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_SETTLEMENT          | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
    94      | 24 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_MARGIN              | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
    95      | 25 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_FEES_INFRASTRUCTURE | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
    96      | 26 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_FEES_LIQUIDITY      | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
    97      | 27 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_FEES_MAKER          | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
    98      | 28 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_LOCK_WITHDRAW       | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
    99      | 29 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_BOND                | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
   100      | 30 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_EXTERNAL            | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
   101      | 31 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GLOBAL_INSURANCE    | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
   102      | 32 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_PENDING_TRANSFERS   | VEGA  | 10000  | 1           |           | 0.5    | unsupported to account type   |
   103      | 33 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 1           | 0         | 0.5    | end epoch is zero             |
   104      | 34 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL                    | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL             | VEGA  | 10000  | 0           |           | 0.5    | start epoch is zero           |
   105  
   106  Scenario: As a user I can create a recurring transfer that decreases over time when start amount * transfer.fee.factor <= transfer.fee.maxQuantumAmount * quantum (0057-TRAN-050, 0057-TRAN-051)
   107      Given the parties deposit on asset's general account the following amount:
   108      | party                                                            | asset | amount  |
   109      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | VEGA  | 1000000 |
   110  
   111      Given the parties submit the following recurring transfers:
   112      | id | from                                                             | from_account_type    | to                                                               | to_account_type      | asset | amount | start_epoch | end_epoch | factor |
   113      | 1  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 | ACCOUNT_TYPE_GENERAL | VEGA  | 10000  | 2           | 5         | 0.7    |
   114  
   115      # end of epoch 1
   116      When the network moves ahead "14" blocks
   117      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "1000000" for asset "VEGA"
   118  
   119      # end of epoch 2
   120      When the network moves ahead "7" blocks
   121      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "985000" for asset "VEGA"
   122      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "10000" for asset "VEGA"
   123  
   124      # end of epoch 3
   125      When the network moves ahead "7" blocks
   126      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "974500" for asset "VEGA"
   127      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "17000" for asset "VEGA"
   128  
   129      # end of epoch 4
   130      When the network moves ahead "7" blocks
   131      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "967150" for asset "VEGA"
   132      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "21900" for asset "VEGA"
   133  
   134      # end of epoch 5 - the transfer is ended so can't be cancelled
   135      When the network moves ahead "8" blocks
   136      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "962005" for asset "VEGA"
   137      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "25330" for asset "VEGA"
   138  
   139      When the parties submit the following transfer cancellations:
   140      | party  | transfer_id |               error                |
   141      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 |      1      | recurring transfer does not exists |
   142  
   143  Scenario: As a user I can create a recurring transfer that decreases over time when start amount * transfer.fee.factor > transfer.fee.maxQuantumAmount * quantum (0057-TRAN-065)
   144      Given the following network parameters are set:
   145        | name                                    | value |
   146        | transfer.fee.factor                     |  1    |
   147        | transfer.fee.maxQuantumAmount           |  0.1  |
   148      
   149      Given the parties deposit on asset's general account the following amount:
   150      | party                                                            | asset | amount  |
   151      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | VEGA  | 1000000 |
   152  
   153      Given the parties submit the following recurring transfers:
   154      | id | from                                                             | from_account_type    | to                                                               | to_account_type      | asset | amount | start_epoch | end_epoch | factor |
   155      | 1  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 | ACCOUNT_TYPE_GENERAL | VEGA  | 10000  | 2           | 5         | 0.7    |
   156      
   157      # end of epoch 1
   158      When the network moves ahead "14" blocks
   159      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "1000000" for asset "VEGA"
   160  
   161      # end of epoch 2
   162      When the network moves ahead "7" blocks
   163      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "985000" for asset "VEGA"
   164      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "10000" for asset "VEGA"
   165  
   166      # end of epoch 3
   167      When the network moves ahead "7" blocks
   168      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "973000" for asset "VEGA"
   169      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "17000" for asset "VEGA"
   170  
   171      # end of epoch 4
   172      When the network moves ahead "7" blocks
   173      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "963200" for asset "VEGA"
   174      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "21900" for asset "VEGA"
   175  
   176      # end of epoch 5 - the transfer is ended so can't be cancelled
   177      When the network moves ahead "8" blocks
   178      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "956340" for asset "VEGA"
   179      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "25330" for asset "VEGA"
   180  
   181      When the parties submit the following transfer cancellations:
   182      | party                                                            | transfer_id | error                              |
   183      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | 1           | recurring transfer does not exists |
   184  
   185  
   186  Scenario: As a user I can create a recurring transfer that recurs forever, with the same balance transferred each time (0057-TRAN-052)
   187      Given the parties deposit on asset's general account the following amount:
   188      | party                                                            | asset | amount  |
   189      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | VEGA  | 1000000 |
   190  
   191      Given the parties submit the following recurring transfers:
   192      | id | from                                                             | from_account_type    | to                                                               | to_account_type      | asset | amount | start_epoch | end_epoch | factor |
   193      | 1  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 | ACCOUNT_TYPE_GENERAL | VEGA  | 1000   | 2           |           | 1      |
   194  
   195       # end of epoch 1
   196      When the network moves ahead "14" blocks
   197      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "1000000" for asset "VEGA"
   198  
   199      # run for 100 epochs
   200      When the network moves ahead "700" blocks
   201      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "850000" for asset "VEGA"
   202      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "100000" for asset "VEGA"
   203  
   204  Scenario: As a user I can create a recurring transfer that recurs as long as the amount is transfer.minTransferQuantumMultiple x quantum, with the amount transfer decreasing. (0057-TRAN-053)
   205      Given the parties deposit on asset's general account the following amount:
   206      | party                                                            | asset | amount |
   207      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | VEGA  | 40000  |
   208  
   209      Given the parties submit the following recurring transfers:
   210      | id | from                                                             | from_account_type    | to                                                               | to_account_type      | asset | amount | start_epoch | end_epoch | factor |
   211      | 1  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 | ACCOUNT_TYPE_GENERAL | VEGA  | 10000  | 2           |           | 0.1    |
   212  
   213      # end of epoch 1
   214      When the network moves ahead "14" blocks
   215      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "40000" for asset "VEGA"
   216  
   217      # end of epoch 2
   218      When the network moves ahead "7" blocks
   219      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "25000" for asset "VEGA"
   220      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "10000" for asset "VEGA"
   221      And the reward account of type "ACCOUNT_TYPE_FEES_INFRASTRUCTURE" should have balance of "5000" for asset "VEGA"
   222  
   223      # end of epoch 3
   224      When the network moves ahead "7" blocks
   225      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "23500" for asset "VEGA"
   226      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "11000" for asset "VEGA"
   227      And the reward account of type "ACCOUNT_TYPE_FEES_INFRASTRUCTURE" should have balance of "5500" for asset "VEGA"
   228  
   229      # at this point the transfer amount for the next epoch is 1000*0.1 = 100 < 0.1 * quantum (=5k) = 500
   230      When the network moves ahead "100" blocks
   231      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "23500" for asset "VEGA"
   232      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "11000" for asset "VEGA"
   233      And the reward account of type "ACCOUNT_TYPE_FEES_INFRASTRUCTURE" should have balance of "5500" for asset "VEGA"
   234  
   235  
   236  Scenario: As a user I can cancel a recurring transfer (0057-TRAN-054)
   237      Given the parties deposit on asset's general account the following amount:
   238      | party                                                            | asset | amount |
   239      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | VEGA  | 40000  |
   240  
   241      Given the parties submit the following recurring transfers:
   242      | id | from                                                             | from_account_type    | to                                                               | to_account_type      | asset | amount | start_epoch | end_epoch | factor |
   243      | 1  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 | ACCOUNT_TYPE_GENERAL | VEGA  | 10000  | 2           |           | 1      |
   244  
   245      # end of epoch 2
   246      When the network moves ahead "21" blocks
   247      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "25000" for asset "VEGA"
   248      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "10000" for asset "VEGA"
   249      And the reward account of type "ACCOUNT_TYPE_FEES_INFRASTRUCTURE" should have balance of "5000" for asset "VEGA"
   250  
   251      When the parties submit the following transfer cancellations:
   252      | party                                                            | transfer_id | error |
   253      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | 1           |       |
   254  
   255     # progress a few epoch - the balance of a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 and 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 should not have changed as the transfer has been cancelled
   256      When the network moves ahead "100" blocks
   257      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "25000" for asset "VEGA"
   258  
   259      # we can't cancel it again because it's already cancelled
   260      When the parties submit the following transfer cancellations:
   261      | party                                                            | transfer_id | error                              |
   262      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | 1           | recurring transfer does not exists |
   263  
   264  Scenario: As a user I can cancel a recurring transfer before any transfers have executed (0057-TRAN-055)
   265      Given the parties deposit on asset's general account the following amount:
   266      | party                                                            | asset | amount |
   267      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | VEGA  | 40000  |
   268  
   269      Given the parties submit the following recurring transfers:
   270      | id | from                                                             | from_account_type    | to                                                               | to_account_type      | asset | amount | start_epoch | end_epoch | factor |
   271      | 1  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 | ACCOUNT_TYPE_GENERAL | VEGA  | 10000  | 2           |           | 1      |
   272  
   273      When the parties submit the following transfer cancellations:
   274      | party                                                            | transfer_id | error |
   275      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | 1           |       |
   276  
   277      # progress a few epoch - the balance of a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 and 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 should not have changed as the transfer has been cancelled
   278      When the network moves ahead "100" blocks
   279      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "40000" for asset "VEGA"
   280  
   281      # we can't cancel it again because it's already cancelled
   282      When the parties submit the following transfer cancellations:
   283      | party                                                            | transfer_id | error                              |
   284      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | 1           | recurring transfer does not exists |
   285  
   286  
   287  Scenario: A user's recurring transfer is cancelled if any transfer fails due to insufficient funds (0057-TRAN-054)
   288      Given the parties deposit on asset's general account the following amount:
   289      | party                                                            | asset | amount |
   290      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | VEGA  | 40000  |
   291  
   292      Given the parties submit the following recurring transfers:
   293      | id | from                                                             | from_account_type    | to                                                               | to_account_type      | asset | amount | start_epoch | end_epoch | factor |
   294      | 1  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303 | ACCOUNT_TYPE_GENERAL | VEGA  | 10000  | 2           |           | 1      |
   295  
   296      # end of epoch 0
   297      When the network moves ahead "7" blocks
   298      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "40000" for asset "VEGA"
   299  
   300      # end of epoch 1
   301      When the network moves ahead "7" blocks
   302      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "40000" for asset "VEGA"
   303  
   304      # end of epoch 2
   305      When the network moves ahead "7" blocks
   306      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "25000" for asset "VEGA"
   307      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "10000" for asset "VEGA"
   308      And the reward account of type "ACCOUNT_TYPE_FEES_INFRASTRUCTURE" should have balance of "5000" for asset "VEGA"
   309  
   310      # end of epoch 3
   311      When the network moves ahead "7" blocks
   312      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "10000" for asset "VEGA"
   313      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "20000" for asset "VEGA"
   314      And the reward account of type "ACCOUNT_TYPE_FEES_INFRASTRUCTURE" should have balance of "10000" for asset "VEGA"
   315  
   316      # end of epoch 4 - there's insufficient funds to execute the transfer - it gets cancelled
   317      When the network moves ahead "7" blocks
   318      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "10000" for asset "VEGA"
   319      Then "576380694832d9271682e86fffbbcebc09ca79c259baa5d4d0298e12ecdee303" should have general account balance of "20000" for asset "VEGA"
   320      And the reward account of type "ACCOUNT_TYPE_FEES_INFRASTRUCTURE" should have balance of "10000" for asset "VEGA"
   321  
   322      When the parties submit the following transfer cancellations:
   323      | party                                                            | transfer_id | error                              |
   324      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | 1           | recurring transfer does not exists |
   325  
   326  
   327  Scenario: As a user I can make a recurring transfer to Global Rewards account by specifying the "0" address and the account type (0013-ACCT-028)
   328      Given the parties deposit on asset's general account the following amount:
   329      | party                                                            | asset | amount |
   330      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | VEGA  | 4000   |
   331  
   332      Given the parties submit the following recurring transfers:
   333      | id | from                                                             | from_account_type    | to                                                               | to_account_type            | asset | amount | start_epoch | end_epoch | factor |
   334      | 1  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_GLOBAL_REWARD | VEGA  | 1000   | 1           | 2         | 1      |
   335  
   336      # end of epoch 0
   337      When the network moves ahead "7" blocks
   338      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "4000" for asset "VEGA"
   339  
   340      # end of epoch 1
   341      # transferring 1k from a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 to 0000000000000000000000000000000000000000000000000000000000000000
   342      When the network moves ahead "1" epochs
   343      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "2500" for asset "VEGA"
   344      And the reward account of type "ACCOUNT_TYPE_GLOBAL_REWARD" should have balance of "1000" for asset "VEGA"
   345  
   346  
   347  @networktreasury-recurring
   348  Scenario: As a user I can make a recurring transfer to Network Treasury account by specifying the "0" address and the account type (0013-ACCT-026)
   349      Given the parties deposit on asset's general account the following amount:
   350      | party                                                            | asset | amount |
   351      | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | VEGA  | 4000   |
   352  
   353      Given the parties submit the following recurring transfers:
   354      | id | from                                                             | from_account_type    | to                                                               | to_account_type               | asset | amount | start_epoch | end_epoch | factor |
   355      | 1  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_NETWORK_TREASURY | VEGA  | 1000   | 1           | 2         | 1      |
   356  
   357      # end of epoch 0
   358      When the network moves ahead "7" blocks
   359      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "4000" for asset "VEGA"
   360  
   361      # end of epoch 1
   362      # transferring 1k from a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 to 0000000000000000000000000000000000000000000000000000000000000000
   363      When the network moves ahead "1" epochs
   364      Then "a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4" should have general account balance of "2500" for asset "VEGA"
   365      And the reward account of type "ACCOUNT_TYPE_NETWORK_TREASURY" should have balance of "1000" for asset "VEGA"