Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: create step to deposit into account #3152

Merged
merged 1 commit into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions integration/execution_layer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ func theInsurancePoolInitialBalanceForTheMarketsIs(amountstr string) error {
return nil
}

func theMakesADepositOfIntoTheAccount(trader, amountstr, asset string) error {
amount, _ := strconv.ParseUint(amountstr, 10, 0)
// row.0 = traderID, row.1 = amount to topup

_, err := execsetup.collateral.Deposit(
context.Background(), trader, asset, amount,
)
return err
}

func generalAccountForAssetBalanceIs(trader, asset, balancestr string) error {
balance, _ := strconv.ParseUint(balancestr, 10, 0)
acc, err := execsetup.broker.GetTraderGeneralAccount(trader, asset)
Expand Down
4 changes: 3 additions & 1 deletion integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ func FeatureContext(s *godog.Suite) {
s.Step(`^The "([^"]*)" withdraw "([^"]*)" from the "([^"]*)" account$`, func(owner, amountStr, asset string) error {
return steps.WithdrawFromAccount(execsetup.collateral, owner, amountStr, asset)
})
s.Step(`^The "([^"]*)" makes a deposit of "([^"]*)" into the "([^"]*)" account$`, theMakesADepositOfIntoTheAccount)
s.Step(`^The "([^"]*)" makes a deposit of "([^"]*)" into the "([^"]*)" account$`, func(owner, amountstr, asset string) error {
return steps.DepositIntoAccount(execsetup.collateral, owner, amountstr, asset)
})
s.Step(`^"([^"]*)" general account for asset "([^"]*)" balance is "([^"]*)"$`, generalAccountForAssetBalanceIs)
s.Step(`^"([^"]*)" have only one account per asset$`, func(owner string) error {
return steps.HaveOnlyOneAccountPerAsset(execsetup.broker, owner)
Expand Down
16 changes: 16 additions & 0 deletions integration/steps/deposit_Into_account.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package steps

import (
"context"
"strconv"

"code.vegaprotocol.io/vega/collateral"
)

func DepositIntoAccount(collateral *collateral.Engine, owner, amountstr, asset string) error {
amount, _ := strconv.ParseUint(amountstr, 10, 0)
_, err := collateral.Deposit(
context.Background(), owner, asset, amount,
)
return err
}