Skip to content

Commit

Permalink
Merge pull request #9783 from vegaprotocol/transfer-acs
Browse files Browse the repository at this point in the history
Transfer acs
  • Loading branch information
AnExsomnis authored Oct 13, 2023
2 parents 27081f6 + fc5a473 commit 76037e4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/integration/features/transfers/one_off_transfers.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Background:
| party | asset | amount |
| f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | VEGA | 10000000 |

And create the network treasury account for asset "VEGA"


Scenario: simple successful transfers (0057-TRAN-001, 0057-TRAN-007, 0057-TRAN-008)
Given the parties submit the following one off transfers:
| id | from | from_account_type | to | to_account_type | asset | amount | delivery_time |
Expand Down Expand Up @@ -148,3 +151,17 @@ Scenario: Cannot cancel scheduled one off transfer (0057-TRAN-010)
When the parties submit the following transfer cancellations:
| party | transfer_id | error |
| f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | 1 | recurring transfer does not exists |

@networktreasury
Scenario: Transfer from general account to Network Treasury Account by specifying "0" address and the account type (0013-ACCT-026)
Given the parties submit the following one off transfers:
| id | from | from_account_type | to | to_account_type | asset | amount | delivery_time |
| 1 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_NETWORK_TREASURY | VEGA | 10000 | 2021-08-26T00:00:01Z |

Then "f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c" should have general account balance of "9985000" for asset "VEGA"

When the network moves ahead "1" epochs
Then "f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c" should have general account balance of "9985000" for asset "VEGA"

# We check the system account receiving the balance because the treasury transfer is on-chain.
And the reward account of type "ACCOUNT_TYPE_PENDING_TRANSFERS" should have balance of "10000" for asset "VEGA"
4 changes: 4 additions & 0 deletions core/integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,10 @@ func InitializeScenario(s *godog.ScenarioContext) {
s.Step(`^the party "([^"]*)" has the following taker notional "([^"]*)"$`, func(party, notional string) error {
return steps.PartyHasTheFollowingTakerNotional(party, notional, execsetup.volumeDiscountProgram)
})

s.Step(`^create the network treasury account for asset "([^"]*)"$`, func(asset string) error {
return steps.CreateNetworkTreasuryAccount(execsetup.collateralEngine, asset)
})
}

func reconcileAccounts() error {
Expand Down
5 changes: 5 additions & 0 deletions core/integration/steps/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@ func (r assetRow) maybeQuantum() *num.Decimal {

return ptr.From(r.row.MustDecimal("quantum"))
}

func CreateNetworkTreasuryAccount(col *collateral.Engine, asset string) error {
_ = col.GetOrCreateNetworkTreasuryAccount(context.Background(), asset)
return nil
}

0 comments on commit 76037e4

Please sign in to comment.