-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fd093a
commit bb9c1f9
Showing
8 changed files
with
607 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
syntax = "proto3"; | ||
package dydxprotocol.indexer.protocol.v1; | ||
|
||
option go_package = "github.com/dydxprotocol/v4-chain/protocol/indexer/protocol/v1/types"; | ||
|
||
// Initial copy of protos from dYdX chain application state protos for the | ||
// vault module for use to send Indexer specific messages. Do not make any | ||
// breaking changes to these protos, a new version should be created if a | ||
// breaking change is needed. | ||
|
||
// VaultStatus represents the status of a vault. | ||
enum VaultStatus { | ||
// Default value, invalid and unused. | ||
VAULT_STATUS_UNSPECIFIED = 0; | ||
|
||
// Don’t place orders. Does not count toward global vault balances. | ||
VAULT_STATUS_DEACTIVATED = 1; | ||
|
||
// Don’t place orders. Does count towards global vault balances. | ||
VAULT_STATUS_STAND_BY = 2; | ||
|
||
// Places orders on both sides of the book. | ||
VAULT_STATUS_QUOTING = 3; | ||
|
||
// Only place orders that close the position. | ||
VAULT_STATUS_CLOSE_ONLY = 4; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package events | ||
|
||
import ( | ||
v1 "github.com/dydxprotocol/v4-chain/protocol/indexer/protocol/v1" | ||
clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" | ||
"github.com/dydxprotocol/v4-chain/protocol/x/vault/types" | ||
) | ||
|
||
// NewUpsertVaultEvent creates a UpsertVaultEventV1 | ||
// representing an create / update of a vault. | ||
func NewUpsertVaultEvent( | ||
vaultAddress string, | ||
clobPairId clobtypes.ClobPairId, | ||
status types.VaultStatus, | ||
) *UpsertVaultEventV1 { | ||
return &UpsertVaultEventV1{ | ||
Address: vaultAddress, | ||
ClobPairId: uint32(clobPairId), | ||
Status: v1.VaultStatusToIndexerVaultStatus(status), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package events_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/dydxprotocol/v4-chain/protocol/indexer/events" | ||
v1types "github.com/dydxprotocol/v4-chain/protocol/indexer/protocol/v1/types" | ||
"github.com/dydxprotocol/v4-chain/protocol/testutil/constants" | ||
vaulttypes "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestNewUpsertVaultEvent_Success(t *testing.T) { | ||
upsertVaultEvent := events.NewUpsertVaultEvent( | ||
constants.Alice_Num0.Owner, | ||
0, | ||
vaulttypes.VaultStatus_VAULT_STATUS_QUOTING, | ||
) | ||
expectedUpsertVaultEventProto := &events.UpsertVaultEventV1{ | ||
Address: constants.Alice_Num0.Owner, | ||
ClobPairId: 0, | ||
Status: v1types.VaultStatus_VAULT_STATUS_QUOTING, | ||
} | ||
require.Equal(t, expectedUpsertVaultEventProto, upsertVaultEvent) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters