diff --git a/CHANGELOG.md b/CHANGELOG.md index 815752291b..29419dcf07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -159,6 +159,7 @@ - [9541](https://github.com/vegaprotocol/vega/issues/9731) - Add X day aggregate totals for referral set referees. - [2985](https://github.com/vegaprotocol/system-tests/issues/2985) - Coverage for insurance pool transfers, fix deadlock when terminating pending market through governance. - [9770](https://github.com/vegaprotocol/vega/issues/9770) - Fix `PnL` flickering bug. +- [9785](https://github.com/vegaprotocol/vega/issues/9785) - Support transfers to netork treasury. ### 🐛 Fixes diff --git a/commands/transfer_funds.go b/commands/transfer_funds.go index 90dbe41fd7..9936d522ff 100644 --- a/commands/transfer_funds.go +++ b/commands/transfer_funds.go @@ -94,7 +94,7 @@ func checkTransfer(cmd *commandspb.Transfer) (e Errors) { } else { switch k := cmd.Kind.(type) { case *commandspb.Transfer_OneOff: - if cmd.ToAccountType != vega.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD && cmd.ToAccountType != vega.AccountType_ACCOUNT_TYPE_GENERAL && cmd.ToAccountType != vega.AccountType_ACCOUNT_TYPE_UNSPECIFIED { + if cmd.ToAccountType != vega.AccountType_ACCOUNT_TYPE_GLOBAL_REWARD && cmd.ToAccountType != vega.AccountType_ACCOUNT_TYPE_GENERAL && cmd.ToAccountType != vega.AccountType_ACCOUNT_TYPE_UNSPECIFIED && cmd.ToAccountType != vega.AccountType_ACCOUNT_TYPE_NETWORK_TREASURY { errs.AddForProperty("transfer.to_account_type", errors.New("account type is not valid for one off transfer")) } if k.OneOff.GetDeliverOn() < 0 { diff --git a/core/collateral/engine.go b/core/collateral/engine.go index ab127b47df..ce10441877 100644 --- a/core/collateral/engine.go +++ b/core/collateral/engine.go @@ -2538,7 +2538,7 @@ func (e *Engine) getTransferFundsTransferRequest(ctx context.Context, t *types.T } // this could not exists as well, let's just create in this case - case types.AccountTypeGlobalReward, types.AccountTypeLPFeeReward, types.AccountTypeMakerReceivedFeeReward, + case types.AccountTypeGlobalReward, types.AccountTypeLPFeeReward, types.AccountTypeMakerReceivedFeeReward, types.AccountTypeNetworkTreasury, types.AccountTypeMakerPaidFeeReward, types.AccountTypeMarketProposerReward, types.AccountTypeAveragePositionReward, types.AccountTypeRelativeReturnReward, types.AccountTypeReturnVolatilityReward, types.AccountTypeValidatorRankingReward: market := noMarket @@ -2550,7 +2550,6 @@ func (e *Engine) getTransferFundsTransferRequest(ctx context.Context, t *types.T // shouldn't happen, we just created it... return nil, err } - default: return nil, fmt.Errorf("unsupported to account for TransferFunds: %v", accountType.String()) } diff --git a/core/integration/features/transfers/one_off_transfers.feature b/core/integration/features/transfers/one_off_transfers.feature index 8726da76b0..8e1e5cfda7 100644 --- a/core/integration/features/transfers/one_off_transfers.feature +++ b/core/integration/features/transfers/one_off_transfers.feature @@ -159,9 +159,11 @@ Scenario: Transfer from general account to Network Treasury Account by specifyin | 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" + # 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" 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 + And the reward account of type "ACCOUNT_TYPE_NETWORK_TREASURY" should have balance of "10000" for asset "VEGA"