From d3e8aff51728121d5398895931d5e0de41460059 Mon Sep 17 00:00:00 2001 From: AnExsomnis Date: Fri, 13 Oct 2023 16:34:05 +0300 Subject: [PATCH] fix: add integration test for AC 0013-ACCT-026 --- .../transfers/one_off_transfers.feature | 17 +++++++++++++++++ core/integration/main_test.go | 4 ++++ core/integration/steps/assets.go | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/core/integration/features/transfers/one_off_transfers.feature b/core/integration/features/transfers/one_off_transfers.feature index 866227a5d71..8726da76b00 100644 --- a/core/integration/features/transfers/one_off_transfers.feature +++ b/core/integration/features/transfers/one_off_transfers.feature @@ -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 | @@ -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" \ No newline at end of file diff --git a/core/integration/main_test.go b/core/integration/main_test.go index b663ef14d21..db9c198d02d 100644 --- a/core/integration/main_test.go +++ b/core/integration/main_test.go @@ -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 { diff --git a/core/integration/steps/assets.go b/core/integration/steps/assets.go index e25dca54df1..f13b5f8e780 100644 --- a/core/integration/steps/assets.go +++ b/core/integration/steps/assets.go @@ -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 +}