diff --git a/README.md b/README.md index c905067fc6..70791266cd 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ By clicking the above links to third-party clients, you will leave the dYdX Trad `proto` — Contains all protocol buffers used by protocol and indexer. -`protocol` — Contains source code for the Cosmos SDK app that runs the protocol. See its [README](https://github.com/dydxprotocol/v4-chain/blob/main/indexer/README.md) for developer documentation. +`protocol` — Contains source code for the Cosmos SDK app that runs the protocol. See its [README](https://github.com/dydxprotocol/v4-chain/blob/main/protocol/README.md) for developer documentation. `v4-proto-js` — Scripts for publishing proto package to [npm](https://www.npmjs.com/package/@dydxprotocol/v4-proto). diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts index bde0abe52e..720980b76d 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts @@ -69,6 +69,9 @@ export interface Perpetual { */ fundingIndex: Uint8Array; + /** Total size of open long contracts, measured in base_quantums. */ + + openInterest: Uint8Array; } /** Perpetual represents a perpetual on the dYdX exchange. */ @@ -81,6 +84,9 @@ export interface PerpetualSDKType { */ funding_index: Uint8Array; + /** Total size of open long contracts, measured in base_quantums. */ + + open_interest: Uint8Array; } /** * PerpetualParams represents the parameters of a perpetual on the dYdX @@ -280,6 +286,19 @@ export interface LiquidityTier { */ impactNotional: Long; + /** + * Lower cap for Open Interest Margin Fracton (OIMF), in quote quantums. + * IMF is not affected when OI <= open_interest_lower_cap. + */ + + openInterestLowerCap: Long; + /** + * Upper cap for Open Interest Margin Fracton (OIMF), in quote quantums. + * IMF scales linearly to 100% as OI approaches open_interest_upper_cap. + * If zero, then the IMF does not scale with OI. + */ + + openInterestUpperCap: Long; } /** LiquidityTier stores margin information. */ @@ -323,12 +342,26 @@ export interface LiquidityTierSDKType { */ impact_notional: Long; + /** + * Lower cap for Open Interest Margin Fracton (OIMF), in quote quantums. + * IMF is not affected when OI <= open_interest_lower_cap. + */ + + open_interest_lower_cap: Long; + /** + * Upper cap for Open Interest Margin Fracton (OIMF), in quote quantums. + * IMF scales linearly to 100% as OI approaches open_interest_upper_cap. + * If zero, then the IMF does not scale with OI. + */ + + open_interest_upper_cap: Long; } function createBasePerpetual(): Perpetual { return { params: undefined, - fundingIndex: new Uint8Array() + fundingIndex: new Uint8Array(), + openInterest: new Uint8Array() }; } @@ -342,6 +375,10 @@ export const Perpetual = { writer.uint32(18).bytes(message.fundingIndex); } + if (message.openInterest.length !== 0) { + writer.uint32(26).bytes(message.openInterest); + } + return writer; }, @@ -362,6 +399,10 @@ export const Perpetual = { message.fundingIndex = reader.bytes(); break; + case 3: + message.openInterest = reader.bytes(); + break; + default: reader.skipType(tag & 7); break; @@ -375,6 +416,7 @@ export const Perpetual = { const message = createBasePerpetual(); message.params = object.params !== undefined && object.params !== null ? PerpetualParams.fromPartial(object.params) : undefined; message.fundingIndex = object.fundingIndex ?? new Uint8Array(); + message.openInterest = object.openInterest ?? new Uint8Array(); return message; } @@ -614,7 +656,9 @@ function createBaseLiquidityTier(): LiquidityTier { initialMarginPpm: 0, maintenanceFractionPpm: 0, basePositionNotional: Long.UZERO, - impactNotional: Long.UZERO + impactNotional: Long.UZERO, + openInterestLowerCap: Long.UZERO, + openInterestUpperCap: Long.UZERO }; } @@ -644,6 +688,14 @@ export const LiquidityTier = { writer.uint32(48).uint64(message.impactNotional); } + if (!message.openInterestLowerCap.isZero()) { + writer.uint32(56).uint64(message.openInterestLowerCap); + } + + if (!message.openInterestUpperCap.isZero()) { + writer.uint32(64).uint64(message.openInterestUpperCap); + } + return writer; }, @@ -680,6 +732,14 @@ export const LiquidityTier = { message.impactNotional = (reader.uint64() as Long); break; + case 7: + message.openInterestLowerCap = (reader.uint64() as Long); + break; + + case 8: + message.openInterestUpperCap = (reader.uint64() as Long); + break; + default: reader.skipType(tag & 7); break; @@ -697,6 +757,8 @@ export const LiquidityTier = { message.maintenanceFractionPpm = object.maintenanceFractionPpm ?? 0; message.basePositionNotional = object.basePositionNotional !== undefined && object.basePositionNotional !== null ? Long.fromValue(object.basePositionNotional) : Long.UZERO; message.impactNotional = object.impactNotional !== undefined && object.impactNotional !== null ? Long.fromValue(object.impactNotional) : Long.UZERO; + message.openInterestLowerCap = object.openInterestLowerCap !== undefined && object.openInterestLowerCap !== null ? Long.fromValue(object.openInterestLowerCap) : Long.UZERO; + message.openInterestUpperCap = object.openInterestUpperCap !== undefined && object.openInterestUpperCap !== null ? Long.fromValue(object.openInterestUpperCap) : Long.UZERO; return message; } diff --git a/proto/dydxprotocol/perpetuals/perpetual.proto b/proto/dydxprotocol/perpetuals/perpetual.proto index c58188f0bb..cb5132ea0f 100644 --- a/proto/dydxprotocol/perpetuals/perpetual.proto +++ b/proto/dydxprotocol/perpetuals/perpetual.proto @@ -17,6 +17,13 @@ message Perpetual { "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", (gogoproto.nullable) = false ]; + + // Total size of open long contracts, measured in base_quantums. + bytes open_interest = 3 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; } enum PerpetualMarketType { @@ -120,4 +127,13 @@ message LiquidityTier { // - Impact ask price = average execution price for a market buy of the // impact notional value. uint64 impact_notional = 6; + + // Lower cap for Open Interest Margin Fracton (OIMF), in quote quantums. + // IMF is not affected when OI <= open_interest_lower_cap. + uint64 open_interest_lower_cap = 7; + + // Upper cap for Open Interest Margin Fracton (OIMF), in quote quantums. + // IMF scales linearly to 100% as OI approaches open_interest_upper_cap. + // If zero, then the IMF does not scale with OI. + uint64 open_interest_upper_cap = 8; } diff --git a/protocol/app/upgrades.go b/protocol/app/upgrades.go index 884ef32fc2..51a6dc9e39 100644 --- a/protocol/app/upgrades.go +++ b/protocol/app/upgrades.go @@ -8,14 +8,12 @@ import ( upgradetypes "cosmossdk.io/x/upgrade/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dydxprotocol/v4-chain/protocol/app/upgrades" - v4_0_0 "github.com/dydxprotocol/v4-chain/protocol/app/upgrades/v4.0.0" ) var ( // `Upgrades` defines the upgrade handlers and store loaders for the application. // New upgrades should be added to this slice after they are implemented. Upgrades = []upgrades.Upgrade{ - v4_0_0.Upgrade, v5_0_0.Upgrade, } Forks = []upgrades.Fork{} @@ -24,18 +22,6 @@ var ( // setupUpgradeHandlers registers the upgrade handlers to perform custom upgrade // logic and state migrations for software upgrades. func (app *App) setupUpgradeHandlers() { - if app.UpgradeKeeper.HasHandler(v4_0_0.UpgradeName) { - panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v4_0_0.UpgradeName)) - } - app.UpgradeKeeper.SetUpgradeHandler( - v4_0_0.UpgradeName, - v4_0_0.CreateUpgradeHandler( - app.ModuleManager, - app.configurator, - app.RatelimitKeeper, - ), - ) - if app.UpgradeKeeper.HasHandler(v5_0_0.UpgradeName) { panic(fmt.Sprintf("Cannot register duplicate upgrade handler '%s'", v5_0_0.UpgradeName)) } diff --git a/protocol/app/upgrades/v5.0.0/constants.go b/protocol/app/upgrades/v5.0.0/constants.go index b79bf75d31..a0cc60328c 100644 --- a/protocol/app/upgrades/v5.0.0/constants.go +++ b/protocol/app/upgrades/v5.0.0/constants.go @@ -1,8 +1,10 @@ -package v5_0_0 +package v_5_0_0 import ( store "cosmossdk.io/store/types" "github.com/dydxprotocol/v4-chain/protocol/app/upgrades" + + vaulttypes "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" ) const ( @@ -12,6 +14,9 @@ const ( var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, + + Added: []string{ + vaulttypes.StoreKey, + }, }, } diff --git a/protocol/app/upgrades/v5.0.0/upgrade.go b/protocol/app/upgrades/v5.0.0/upgrade.go index 693547a14e..b3326fe4e2 100644 --- a/protocol/app/upgrades/v5.0.0/upgrade.go +++ b/protocol/app/upgrades/v5.0.0/upgrade.go @@ -1,4 +1,4 @@ -package v5_0_0 +package v_5_0_0 import ( "context" @@ -20,12 +20,10 @@ func perpetualsUpgrade( ) error { // Set all perpetuals to cross market type - perpetuals, err := perpetualsKeeper.GetAllPerpetuals(ctx) - if err != nil { - panic(fmt.Sprintf("failed to get all perpetuals: %s", err)) - } + perpetuals := perpetualsKeeper.GetAllPerpetuals(ctx) for _, p := range perpetuals { - _, err = perpetualsKeeper.SetPerpetualMarketType(ctx, p.GetId(), + _, err := perpetualsKeeper.SetPerpetualMarketType( + ctx, p.GetId(), perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS) if err != nil { panic(fmt.Sprintf("failed to set perpetual market type for perpetual %d: %s", p.GetId(), err)) @@ -47,6 +45,8 @@ func CreateUpgradeHandler( // Set all perpetuals to cross market type perpetualsUpgrade(sdkCtx, perpetualsKeeper) + // TODO(TRA-93): Initialize `x/vault` module. + return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/protocol/mocks/ClobKeeper.go b/protocol/mocks/ClobKeeper.go index 4799fd2d86..94ac934d53 100644 --- a/protocol/mocks/ClobKeeper.go +++ b/protocol/mocks/ClobKeeper.go @@ -264,13 +264,13 @@ func (_m *ClobKeeper) GetIndexerEventManager() indexer_manager.IndexerEventManag return r0 } -// GetInsuranceFundBalance provides a mock function with given fields: ctx +// GetInsuranceFundBalance provides a mock function with given fields: ctx, perpetualId func (_m *ClobKeeper) GetInsuranceFundBalance(ctx types.Context, perpetualId uint32) *big.Int { - ret := _m.Called(ctx) + ret := _m.Called(ctx, perpetualId) var r0 *big.Int - if rf, ok := ret.Get(0).(func(types.Context) *big.Int); ok { - r0 = rf(ctx) + if rf, ok := ret.Get(0).(func(types.Context, uint32) *big.Int); ok { + r0 = rf(ctx, perpetualId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*big.Int) @@ -557,6 +557,11 @@ func (_m *ClobKeeper) InitializeEquityTierLimit(ctx types.Context, config clobty return r0 } +// InitializeNewGrpcStreams provides a mock function with given fields: ctx +func (_m *ClobKeeper) InitializeNewGrpcStreams(ctx types.Context) { + _m.Called(ctx) +} + // IsLiquidatable provides a mock function with given fields: ctx, subaccountId func (_m *ClobKeeper) IsLiquidatable(ctx types.Context, subaccountId subaccountstypes.SubaccountId) (bool, error) { ret := _m.Called(ctx, subaccountId) diff --git a/protocol/mocks/MemClob.go b/protocol/mocks/MemClob.go index 48da388ea0..fd027b818e 100644 --- a/protocol/mocks/MemClob.go +++ b/protocol/mocks/MemClob.go @@ -153,6 +153,22 @@ func (_m *MemClob) GetMidPrice(ctx types.Context, clobPairId clobtypes.ClobPairI return r0, r1, r2, r3 } +// GetOffchainUpdatesForOrderbookSnapshot provides a mock function with given fields: ctx, clobPairId +func (_m *MemClob) GetOffchainUpdatesForOrderbookSnapshot(ctx types.Context, clobPairId clobtypes.ClobPairId) *clobtypes.OffchainUpdates { + ret := _m.Called(ctx, clobPairId) + + var r0 *clobtypes.OffchainUpdates + if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPairId) *clobtypes.OffchainUpdates); ok { + r0 = rf(ctx, clobPairId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clobtypes.OffchainUpdates) + } + } + + return r0 +} + // GetOperationsRaw provides a mock function with given fields: ctx func (_m *MemClob) GetOperationsRaw(ctx types.Context) []clobtypes.OperationRaw { ret := _m.Called(ctx) diff --git a/protocol/mocks/PerpetualsKeeper.go b/protocol/mocks/PerpetualsKeeper.go index 921b9a486e..46a4afac45 100644 --- a/protocol/mocks/PerpetualsKeeper.go +++ b/protocol/mocks/PerpetualsKeeper.go @@ -245,23 +245,23 @@ func (_m *PerpetualsKeeper) PerformStatefulPremiumVotesValidation(ctx types.Cont return r0 } -// SetLiquidityTier provides a mock function with given fields: ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional -func (_m *PerpetualsKeeper) SetLiquidityTier(ctx types.Context, id uint32, name string, initialMarginPpm uint32, maintenanceFractionPpm uint32, impactNotional uint64) (perpetualstypes.LiquidityTier, error) { - ret := _m.Called(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional) +// SetLiquidityTier provides a mock function with given fields: ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional, openInterestLowerCap, openInterestUpperCap +func (_m *PerpetualsKeeper) SetLiquidityTier(ctx types.Context, id uint32, name string, initialMarginPpm uint32, maintenanceFractionPpm uint32, impactNotional uint64, openInterestLowerCap uint64, openInterestUpperCap uint64) (perpetualstypes.LiquidityTier, error) { + ret := _m.Called(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional, openInterestLowerCap, openInterestUpperCap) var r0 perpetualstypes.LiquidityTier var r1 error - if rf, ok := ret.Get(0).(func(types.Context, uint32, string, uint32, uint32, uint64) (perpetualstypes.LiquidityTier, error)); ok { - return rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional) + if rf, ok := ret.Get(0).(func(types.Context, uint32, string, uint32, uint32, uint64, uint64, uint64) (perpetualstypes.LiquidityTier, error)); ok { + return rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional, openInterestLowerCap, openInterestUpperCap) } - if rf, ok := ret.Get(0).(func(types.Context, uint32, string, uint32, uint32, uint64) perpetualstypes.LiquidityTier); ok { - r0 = rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional) + if rf, ok := ret.Get(0).(func(types.Context, uint32, string, uint32, uint32, uint64, uint64, uint64) perpetualstypes.LiquidityTier); ok { + r0 = rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional, openInterestLowerCap, openInterestUpperCap) } else { r0 = ret.Get(0).(perpetualstypes.LiquidityTier) } - if rf, ok := ret.Get(1).(func(types.Context, uint32, string, uint32, uint32, uint64) error); ok { - r1 = rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional) + if rf, ok := ret.Get(1).(func(types.Context, uint32, string, uint32, uint32, uint64, uint64, uint64) error); ok { + r1 = rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional, openInterestLowerCap, openInterestUpperCap) } else { r1 = ret.Error(1) } diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index 57b6375850..ac04970e33 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -862,7 +862,9 @@ "impact_notional": 10000000000, "initial_margin_ppm": 50000, "maintenance_fraction_ppm": 600000, - "name": "Large-Cap" + "name": "Large-Cap", + "open_interest_lower_cap": 0, + "open_interest_upper_cap": 0 }, { "base_position_notional": 250000000000, @@ -870,7 +872,9 @@ "impact_notional": 5000000000, "initial_margin_ppm": 100000, "maintenance_fraction_ppm": 500000, - "name": "Mid-Cap" + "name": "Mid-Cap", + "open_interest_lower_cap": 25000000000000, + "open_interest_upper_cap": 50000000000000 }, { "base_position_notional": 100000000000, @@ -878,7 +882,9 @@ "impact_notional": 2500000000, "initial_margin_ppm": 200000, "maintenance_fraction_ppm": 500000, - "name": "Long-Tail" + "name": "Long-Tail", + "open_interest_lower_cap": 10000000000000, + "open_interest_upper_cap": 20000000000000 }, { "base_position_notional": 1000000000, @@ -886,7 +892,9 @@ "impact_notional": 2500000000, "initial_margin_ppm": 1000000, "maintenance_fraction_ppm": 200000, - "name": "Safety" + "name": "Safety", + "open_interest_lower_cap": 0, + "open_interest_upper_cap": 0 } ], "params": { @@ -1816,7 +1824,7 @@ ] } }, - "app_version": "4.0.0-dev0-59-g5530ea29", + "app_version": "4.0.0-dev0-62-g95853be5", "chain_id": "dydx-sample-1", "consensus": { "params": { diff --git a/protocol/streaming/grpc/grpc_streaming_manager.go b/protocol/streaming/grpc/grpc_streaming_manager.go index 5ab3fbbde8..95ae0a984e 100644 --- a/protocol/streaming/grpc/grpc_streaming_manager.go +++ b/protocol/streaming/grpc/grpc_streaming_manager.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/gogoproto/proto" ocutypes "github.com/dydxprotocol/v4-chain/protocol/indexer/off_chain_updates/types" + "github.com/dydxprotocol/v4-chain/protocol/lib" "github.com/dydxprotocol/v4-chain/protocol/streaming/grpc/types" clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" ) @@ -22,8 +23,14 @@ type GrpcStreamingManagerImpl struct { // OrderbookSubscription represents a active subscription to the orderbook updates stream. type OrderbookSubscription struct { + // Initialize the subscription with orderbook snapshots. + initialize sync.Once + + // Clob pair ids to subscribe to. clobPairIds []uint32 - srv clobtypes.Query_StreamOrderbookUpdatesServer + + // Stream + srv clobtypes.Query_StreamOrderbookUpdatesServer } func NewGrpcStreamingManager() *GrpcStreamingManagerImpl { @@ -68,6 +75,7 @@ func (sm *GrpcStreamingManagerImpl) Subscribe( // sends messages to the subscribers. func (sm *GrpcStreamingManagerImpl) SendOrderbookUpdates( offchainUpdates *clobtypes.OffchainUpdates, + snapshot bool, ) { // Group updates by clob pair id. updates := make(map[uint32]*clobtypes.OffchainUpdates) @@ -100,7 +108,7 @@ func (sm *GrpcStreamingManagerImpl) SendOrderbookUpdates( if err := subscription.srv.Send( &clobtypes.StreamOrderbookUpdatesResponse{ Updates: updates, - Snapshot: false, + Snapshot: snapshot, }, ); err != nil { idsToRemove = append(idsToRemove, id) @@ -117,6 +125,25 @@ func (sm *GrpcStreamingManagerImpl) SendOrderbookUpdates( } } +// GetUninitializedClobPairIds returns the clob pair ids that have not been initialized. +func (sm *GrpcStreamingManagerImpl) GetUninitializedClobPairIds() []uint32 { + sm.Lock() + defer sm.Unlock() + + clobPairIds := make(map[uint32]bool) + for _, subscription := range sm.orderbookSubscriptions { + subscription.initialize.Do( + func() { + for _, clobPairId := range subscription.clobPairIds { + clobPairIds[clobPairId] = true + } + }, + ) + } + + return lib.GetSortedKeys[lib.Sortable[uint32]](clobPairIds) +} + // GetOffchainUpdatesV1 unmarshals messages in offchain updates to OffchainUpdateV1. func GetOffchainUpdatesV1(offchainUpdates *clobtypes.OffchainUpdates) ([]ocutypes.OffChainUpdateV1, error) { v1updates := make([]ocutypes.OffChainUpdateV1, 0) diff --git a/protocol/streaming/grpc/noop_streaming_manager.go b/protocol/streaming/grpc/noop_streaming_manager.go index 467b18864b..f8cc229772 100644 --- a/protocol/streaming/grpc/noop_streaming_manager.go +++ b/protocol/streaming/grpc/noop_streaming_manager.go @@ -28,5 +28,10 @@ func (sm *NoopGrpcStreamingManager) Subscribe( func (sm *NoopGrpcStreamingManager) SendOrderbookUpdates( updates *clobtypes.OffchainUpdates, + snapshot bool, ) { } + +func (sm *NoopGrpcStreamingManager) GetUninitializedClobPairIds() []uint32 { + return []uint32{} +} diff --git a/protocol/streaming/grpc/types/manager.go b/protocol/streaming/grpc/types/manager.go index 49882209a6..0027358e79 100644 --- a/protocol/streaming/grpc/types/manager.go +++ b/protocol/streaming/grpc/types/manager.go @@ -14,5 +14,9 @@ type GrpcStreamingManager interface { ) ( err error, ) - SendOrderbookUpdates(*clobtypes.OffchainUpdates) + GetUninitializedClobPairIds() []uint32 + SendOrderbookUpdates( + offchainUpdates *clobtypes.OffchainUpdates, + snapshot bool, + ) } diff --git a/protocol/testing/containertest/containertest.sh b/protocol/testing/containertest/containertest.sh index e040e08d7e..2ab7b89baa 100755 --- a/protocol/testing/containertest/containertest.sh +++ b/protocol/testing/containertest/containertest.sh @@ -7,6 +7,7 @@ set -eo pipefail source "./genesis.sh" CHAIN_ID="localdydxprotocol" +PREUPGRADE_VERSION="v4.0.0-rc1" # Define mnemonics for all validators. MNEMONICS=( @@ -153,22 +154,27 @@ setup_cosmovisor() { done } -copy_preupgrade_binary_arch() { +download_preupgrade_binary() { arch="$(apk --print-arch)" - file_arch="" + url_arch="" case "$arch" in 'x86_64') - file_arch='amd64' + url_arch='amd64' ;; 'aarch64') - file_arch='arm64' + url_arch='arm64' ;; *) echo >&2 "unexpected architecture '$arch'" exit 1 ;; esac - cp /bin/dydxprotocold_preupgrade_${file_arch} /bin/dydxprotocold_preupgrade + tar_url="https://github.com/dydxprotocol/v4-chain/releases/download/protocol%2F$PREUPGRADE_VERSION/dydxprotocold-$PREUPGRADE_VERSION-linux-$url_arch.tar.gz" + tar_path='/tmp/dydxprotocold/dydxprotocold.tar.gz' + mkdir -p /tmp/dydxprotocold + curl -vL $tar_url -o $tar_path + dydxprotocold_path=$(tar -xvf $tar_path --directory /tmp/dydxprotocold) + cp /tmp/dydxprotocold/$dydxprotocold_path /bin/dydxprotocold_preupgrade } # TODO(DEC-1894): remove this function once we migrate off of persistent peers. @@ -187,5 +193,5 @@ edit_config() { install_prerequisites setup_cosmovisor -copy_preupgrade_binary_arch +download_preupgrade_binary create_validators diff --git a/protocol/testing/containertest/dydxprotocold_preupgrade_amd64 b/protocol/testing/containertest/dydxprotocold_preupgrade_amd64 deleted file mode 100755 index 2421184766..0000000000 Binary files a/protocol/testing/containertest/dydxprotocold_preupgrade_amd64 and /dev/null differ diff --git a/protocol/testing/containertest/dydxprotocold_preupgrade_arm64 b/protocol/testing/containertest/dydxprotocold_preupgrade_arm64 deleted file mode 100755 index b144f56f48..0000000000 Binary files a/protocol/testing/containertest/dydxprotocold_preupgrade_arm64 and /dev/null differ diff --git a/protocol/testing/containertest/preupgrade_genesis.json b/protocol/testing/containertest/preupgrade_genesis.json index 7c7947bb47..086d0ffa5d 100644 --- a/protocol/testing/containertest/preupgrade_genesis.json +++ b/protocol/testing/containertest/preupgrade_genesis.json @@ -1,2266 +1,2216 @@ { - "genesis_time": "2024-01-04T00:00:00Z", - "chain_id": "localdydxprotocol", - "initial_height": "1", - "consensus_params": { - "block": { - "max_bytes": "4194304", - "max_gas": "-1" + "app_name": "dydxprotocold", + "app_version": "4.0.0-rc3", + "genesis_time": "2023-01-01T00:00:00Z", + "chain_id": "localdydxprotocol", + "initial_height": 1, + "app_hash": null, + "app_state": { + "assets": { + "assets": [ + { + "atomic_resolution": -6, + "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", + "denom_exponent": "-6", + "has_market": false, + "id": 0, + "market_id": 0, + "symbol": "USDC" + } + ] + }, + "auth": { + "params": { + "max_memo_characters": "256", + "tx_sig_limit": "7", + "tx_size_cost_per_byte": "10", + "sig_verify_cost_ed25519": "590", + "sig_verify_cost_secp256k1": "1000" }, - "evidence": { - "max_age_num_blocks": "100000", - "max_age_duration": "172800000000000", - "max_bytes": "1048576" + "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "address": "dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4", + "pub_key": null, + "account_number": "0", + "sequence": "0" + }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "address": "dydx10fx7sy6ywd5senxae9dwytf8jxek3t2gcen2vs", + "pub_key": null, + "account_number": "1", + "sequence": "0" + }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "address": "dydx1fjg6zp6vv8t9wvy4lps03r5l4g7tkjw9wvmh70", + "pub_key": null, + "account_number": "2", + "sequence": "0" + }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "address": "dydx1wau5mja7j7zdavtfq9lu7ejef05hm6ffenlcsn", + "pub_key": null, + "account_number": "3", + "sequence": "0" + }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "address": "dydx1nzuttarf5k2j0nug5yzhr6p74t9avehn9hlh8m", + "pub_key": null, + "account_number": "4", + "sequence": "0" + } + ] + }, + "authz": { + "authorization": [] + }, + "bank": { + "params": { + "send_enabled": [], + "default_send_enabled": true }, - "validator": { - "pub_key_types": [ - "ed25519" + "balances": [ + { + "address": "dydx1zlefkpe3g0vvm9a4h0jf9000lmqutlh9jwjnsv", + "coins": [ + { + "denom": "adv4tnt", + "amount": "795000000000000000000000000" + } + ] + }, + { + "address": "dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4", + "coins": [ + { + "denom": "adv4tnt", + "amount": "1000000000000000000000000" + }, + { + "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", + "amount": "100000000000000000" + } + ] + }, + { + "address": "dydx1fjg6zp6vv8t9wvy4lps03r5l4g7tkjw9wvmh70", + "coins": [ + { + "denom": "adv4tnt", + "amount": "1000000000000000000000000" + }, + { + "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", + "amount": "100000000000000000" + } + ] + }, + { + "address": "dydx1v88c3xv9xyv3eetdx0tvcmq7ung3dywp5upwc6", + "coins": [ + { + "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", + "amount": "1300000000000000000" + } + ] + }, + { + "address": "dydx1wau5mja7j7zdavtfq9lu7ejef05hm6ffenlcsn", + "coins": [ + { + "denom": "adv4tnt", + "amount": "1000000000000000000000000" + }, + { + "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", + "amount": "100000000000000000" + } + ] + }, + { + "address": "dydx10fx7sy6ywd5senxae9dwytf8jxek3t2gcen2vs", + "coins": [ + { + "denom": "adv4tnt", + "amount": "1000000000000000000000000" + }, + { + "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", + "amount": "100000000000000000" + } + ] + }, + { + "address": "dydx1nzuttarf5k2j0nug5yzhr6p74t9avehn9hlh8m", + "coins": [ + { + "denom": "adv4tnt", + "amount": "1000000000000000000000000" + }, + { + "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", + "amount": "900000000000000000" + } + ] + }, + { + "address": "dydx1ltyc6y4skclzafvpznpt2qjwmfwgsndp458rmp", + "coins": [ + { + "denom": "adv4tnt", + "amount": "200000000000000000000000000" + } + ] + } + ], + "supply": [], + "denom_metadata": [ + { + "description": "The native token of the network", + "denom_units": [ + { + "denom": "adv4tnt", + "exponent": 0, + "aliases": [] + }, + { + "denom": "dv4tnt", + "exponent": 18, + "aliases": [] + } + ], + "base": "adv4tnt", + "display": "dv4tnt", + "name": "dYdX V4 Testnet Token", + "symbol": "dv4tnt", + "uri": "", + "uri_hash": "" + } + ], + "send_enabled": [] + }, + "blocktime": { + "params": { + "durations": [ + "300s", + "1800s" ] + } + }, + "bridge": { + "acknowledged_event_info": { + "eth_block_height": 4322136, + "next_id": 5 }, - "version": { - "app": "0" + "event_params": { + "denom": "adv4tnt", + "eth_address": "0xf75012c350e4ad55be2048bd67ce6e03b20de82d", + "eth_chain_id": 11155111 + }, + "propose_params": { + "max_bridges_per_block": 10, + "propose_delay_duration": "60s", + "skip_if_block_delayed_by_duration": "5s", + "skip_rate_ppm": 800000 + }, + "safety_params": { + "delay_blocks": 86400, + "is_disabled": false } }, - "app_hash": "", - "app_state": { - "assets": { - "assets": [ + "capability": { + "index": "1", + "owners": [] + }, + "clob": { + "block_rate_limit_config": { + "max_short_term_order_cancellations_per_n_blocks": [ { - "atomic_resolution": -6, - "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", - "denom_exponent": "-6", - "has_market": false, - "id": 0, - "market_id": 0, - "symbol": "USDC" + "limit": 200, + "num_blocks": 1 + } + ], + "max_short_term_orders_per_n_blocks": [ + { + "limit": 200, + "num_blocks": 1 + } + ], + "max_stateful_orders_per_n_blocks": [ + { + "limit": 2, + "num_blocks": 1 + }, + { + "limit": 20, + "num_blocks": 100 } ] }, - "auth": { - "params": { - "max_memo_characters": "256", - "tx_sig_limit": "7", - "tx_size_cost_per_byte": "10", - "sig_verify_cost_ed25519": "590", - "sig_verify_cost_secp256k1": "1000" + "clob_pairs": [ + { + "id": 0, + "perpetual_clob_metadata": { + "perpetual_id": 0 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 100000 + }, + { + "id": 1, + "perpetual_clob_metadata": { + "perpetual_id": 1 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 100000 + }, + { + "id": 2, + "perpetual_clob_metadata": { + "perpetual_id": 2 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 3, + "perpetual_clob_metadata": { + "perpetual_id": 3 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 4, + "perpetual_clob_metadata": { + "perpetual_id": 4 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 5, + "perpetual_clob_metadata": { + "perpetual_id": 5 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 6, + "perpetual_clob_metadata": { + "perpetual_id": 6 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 7, + "perpetual_clob_metadata": { + "perpetual_id": 7 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 8, + "perpetual_clob_metadata": { + "perpetual_id": 8 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 9, + "perpetual_clob_metadata": { + "perpetual_id": 9 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 10, + "perpetual_clob_metadata": { + "perpetual_id": 10 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 }, - "accounts": [ + { + "id": 11, + "perpetual_clob_metadata": { + "perpetual_id": 11 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 12, + "perpetual_clob_metadata": { + "perpetual_id": 12 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 13, + "perpetual_clob_metadata": { + "perpetual_id": 13 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 14, + "perpetual_clob_metadata": { + "perpetual_id": 14 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 15, + "perpetual_clob_metadata": { + "perpetual_id": 15 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 16, + "perpetual_clob_metadata": { + "perpetual_id": 16 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 17, + "perpetual_clob_metadata": { + "perpetual_id": 17 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 18, + "perpetual_clob_metadata": { + "perpetual_id": 18 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 19, + "perpetual_clob_metadata": { + "perpetual_id": 19 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 20, + "perpetual_clob_metadata": { + "perpetual_id": 20 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 21, + "perpetual_clob_metadata": { + "perpetual_id": 21 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 22, + "perpetual_clob_metadata": { + "perpetual_id": 22 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 23, + "perpetual_clob_metadata": { + "perpetual_id": 23 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 24, + "perpetual_clob_metadata": { + "perpetual_id": 24 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 25, + "perpetual_clob_metadata": { + "perpetual_id": 25 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 26, + "perpetual_clob_metadata": { + "perpetual_id": 26 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 27, + "perpetual_clob_metadata": { + "perpetual_id": 27 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 28, + "perpetual_clob_metadata": { + "perpetual_id": 28 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 29, + "perpetual_clob_metadata": { + "perpetual_id": 29 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 30, + "perpetual_clob_metadata": { + "perpetual_id": 30 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 31, + "perpetual_clob_metadata": { + "perpetual_id": 31 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + }, + { + "id": 32, + "perpetual_clob_metadata": { + "perpetual_id": 32 + }, + "quantum_conversion_exponent": -9, + "status": "STATUS_ACTIVE", + "step_base_quantums": 1000000, + "subticks_per_tick": 1000000 + } + ], + "equity_tier_limit_config": { + "short_term_order_equity_tiers": [ + { + "limit": 0, + "usd_tnc_required": "0" + }, + { + "limit": 1, + "usd_tnc_required": "20000000" + }, + { + "limit": 5, + "usd_tnc_required": "100000000" + }, + { + "limit": 10, + "usd_tnc_required": "1000000000" + }, + { + "limit": 100, + "usd_tnc_required": "10000000000" + }, { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4", - "pub_key": null, - "account_number": "0", - "sequence": "0" + "limit": 1000, + "usd_tnc_required": "100000000000" + } + ], + "stateful_order_equity_tiers": [ + { + "limit": 0, + "usd_tnc_required": "0" + }, + { + "limit": 1, + "usd_tnc_required": "20000000" }, { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "dydx10fx7sy6ywd5senxae9dwytf8jxek3t2gcen2vs", - "pub_key": null, - "account_number": "1", - "sequence": "0" + "limit": 5, + "usd_tnc_required": "100000000" }, { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "dydx1fjg6zp6vv8t9wvy4lps03r5l4g7tkjw9wvmh70", - "pub_key": null, - "account_number": "2", - "sequence": "0" + "limit": 10, + "usd_tnc_required": "1000000000" }, { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "dydx1wau5mja7j7zdavtfq9lu7ejef05hm6ffenlcsn", - "pub_key": null, - "account_number": "3", - "sequence": "0" + "limit": 100, + "usd_tnc_required": "10000000000" }, { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "dydx1nzuttarf5k2j0nug5yzhr6p74t9avehn9hlh8m", - "pub_key": null, - "account_number": "4", - "sequence": "0" + "limit": 200, + "usd_tnc_required": "100000000000" } ] }, - "bank": { - "params": { - "send_enabled": [], - "default_send_enabled": true + "liquidations_config": { + "fillable_price_config": { + "bankruptcy_adjustment_ppm": 1000000, + "spread_to_maintenance_margin_ratio_ppm": 1500000 }, - "balances": [ - { - "address": "dydx1zlefkpe3g0vvm9a4h0jf9000lmqutlh9jwjnsv", - "coins": [ + "max_liquidation_fee_ppm": 15000, + "position_block_limits": { + "max_position_portion_liquidated_ppm": 100000, + "min_position_notional_liquidated": 1000000000 + }, + "subaccount_block_limits": { + "max_notional_liquidated": 100000000000, + "max_quantums_insurance_lost": 1000000000000 + } + } + }, + "crisis": { + "constant_fee": { + "amount": "1000", + "denom": "adv4tnt" + } + }, + "delaymsg": { + "delayed_messages": [ + { + "block_height": 378000, + "id": 0, + "msg": { + "@type": "/dydxprotocol.feetiers.MsgUpdatePerpetualFeeParams", + "authority": "dydx1mkkvp26dngu6n8rmalaxyp3gwkjuzztq5zx6tr", + "params": { + "tiers": [ + { + "absolute_volume_requirement": "0", + "maker_fee_ppm": 100, + "maker_volume_share_requirement_ppm": 0, + "name": "1", + "taker_fee_ppm": 500, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "1000000000000", + "maker_fee_ppm": 100, + "maker_volume_share_requirement_ppm": 0, + "name": "2", + "taker_fee_ppm": 450, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "5000000000000", + "maker_fee_ppm": 50, + "maker_volume_share_requirement_ppm": 0, + "name": "3", + "taker_fee_ppm": 400, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "25000000000000", + "maker_fee_ppm": 0, + "maker_volume_share_requirement_ppm": 0, + "name": "4", + "taker_fee_ppm": 350, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": 0, + "maker_volume_share_requirement_ppm": 0, + "name": "5", + "taker_fee_ppm": 300, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": -50, + "maker_volume_share_requirement_ppm": 0, + "name": "6", + "taker_fee_ppm": 250, + "total_volume_share_requirement_ppm": 5000 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": -70, + "maker_volume_share_requirement_ppm": 10000, + "name": "7", + "taker_fee_ppm": 250, + "total_volume_share_requirement_ppm": 5000 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": -90, + "maker_volume_share_requirement_ppm": 20000, + "name": "8", + "taker_fee_ppm": 250, + "total_volume_share_requirement_ppm": 5000 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 40000, + "name": "9", + "taker_fee_ppm": 250, + "total_volume_share_requirement_ppm": 5000 + } + ] + } + } + } + ], + "next_delayed_message_id": 1 + }, + "distribution": { + "delegator_starting_infos": [], + "delegator_withdraw_infos": [], + "fee_pool": { + "community_pool": [] + }, + "outstanding_rewards": [], + "params": { + "base_proposer_reward": "0.000000000000000000", + "bonus_proposer_reward": "0.000000000000000000", + "community_tax": "0.020000000000000000", + "withdraw_addr_enabled": true + }, + "previous_proposer": "", + "validator_accumulated_commissions": [], + "validator_current_rewards": [], + "validator_historical_rewards": [], + "validator_slash_events": [] + }, + "epochs": { + "epoch_info_list": [ + { + "current_epoch": 0, + "current_epoch_start_block": 0, + "duration": 60, + "fast_forward_next_tick": true, + "is_initialized": false, + "name": "funding-sample", + "next_tick": 30 + }, + { + "current_epoch": 0, + "current_epoch_start_block": 0, + "duration": 3600, + "fast_forward_next_tick": true, + "is_initialized": false, + "name": "funding-tick", + "next_tick": 0 + }, + { + "current_epoch": 0, + "current_epoch_start_block": 0, + "duration": 3600, + "fast_forward_next_tick": true, + "is_initialized": false, + "name": "stats-epoch", + "next_tick": 0 + } + ] + }, + "evidence": { + "evidence": [] + }, + "feegrant": { + "allowances": [] + }, + "feetiers": { + "params": { + "tiers": [ + { + "absolute_volume_requirement": "0", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 0, + "name": "1", + "taker_fee_ppm": 500, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "1000000000000", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 0, + "name": "2", + "taker_fee_ppm": 450, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "5000000000000", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 0, + "name": "3", + "taker_fee_ppm": 400, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "25000000000000", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 0, + "name": "4", + "taker_fee_ppm": 350, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 0, + "name": "5", + "taker_fee_ppm": 300, + "total_volume_share_requirement_ppm": 0 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 0, + "name": "6", + "taker_fee_ppm": 250, + "total_volume_share_requirement_ppm": 5000 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 10000, + "name": "7", + "taker_fee_ppm": 250, + "total_volume_share_requirement_ppm": 5000 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 20000, + "name": "8", + "taker_fee_ppm": 250, + "total_volume_share_requirement_ppm": 5000 + }, + { + "absolute_volume_requirement": "125000000000000", + "maker_fee_ppm": -110, + "maker_volume_share_requirement_ppm": 40000, + "name": "9", + "taker_fee_ppm": 250, + "total_volume_share_requirement_ppm": 5000 + } + ] + } + }, + "genutil": { + "gen_txs": [ + { + "body": { + "messages": [ { - "denom": "adv4tnt", - "amount": "795000000000000000000000000" + "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", + "description": { + "moniker": "alice", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "commission": { + "rate": "1.000000000000000000", + "max_rate": "1.000000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "min_self_delegation": "1", + "delegator_address": "dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4", + "validator_address": "dydxvaloper199tqg4wdlnu4qjlxchpd7seg454937hjxg9yhy", + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "YiARx8259Z+fGFUxQLrz/5FU2RYRT6f5yzvt7D7CrQM=" + }, + "value": { + "denom": "adv4tnt", + "amount": "500000000000000000000000" + } } - ] + ], + "memo": "17e5e45691f0d01449c84fd4ae87279578cdd7ec@172.17.0.2:26656", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [] }, - { - "address": "dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4", - "coins": [ + "auth_info": { + "signer_infos": [ { - "denom": "adv4tnt", - "amount": "1000000000000000000000000" - }, - { - "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", - "amount": "100000000000000000" + "public_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "A0iQ+HpUfJGcgcH7iiEzY9VwCYWCTwg5LsTjc/q1XwSc" + }, + "mode_info": { + "single": { + "mode": "SIGN_MODE_DIRECT" + } + }, + "sequence": "0" } - ] + ], + "fee": { + "amount": [], + "gas_limit": "200000", + "payer": "", + "granter": "" + }, + "tip": null }, - { - "address": "dydx1fjg6zp6vv8t9wvy4lps03r5l4g7tkjw9wvmh70", - "coins": [ - { - "denom": "adv4tnt", - "amount": "1000000000000000000000000" - }, + "signatures": [ + "OPf+X9U5GJwJOeTpBgW4HBpEP9PEivbMoUzy3WZiriMEghRJLuP3LGVpp4ePr8tEBoEEDFFu11ThiiyzjcmxIQ==" + ] + }, + { + "body": { + "messages": [ { - "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", - "amount": "100000000000000000" + "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", + "description": { + "moniker": "carl", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "commission": { + "rate": "1.000000000000000000", + "max_rate": "1.000000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "min_self_delegation": "1", + "delegator_address": "dydx1fjg6zp6vv8t9wvy4lps03r5l4g7tkjw9wvmh70", + "validator_address": "dydxvaloper1fjg6zp6vv8t9wvy4lps03r5l4g7tkjw9tjdp47", + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "ytLfs1W6E2I41iteKC/YwjyZ/51+CAYCHYxmRHiBeY4=" + }, + "value": { + "denom": "adv4tnt", + "amount": "500000000000000000000000" + } } - ] + ], + "memo": "47539956aaa8e624e0f1d926040e54908ad0eb44@172.17.0.2:26656", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [] }, - { - "address": "dydx1v88c3xv9xyv3eetdx0tvcmq7ung3dywp5upwc6", - "coins": [ + "auth_info": { + "signer_infos": [ { - "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", - "amount": "1300000000000000000" + "public_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "AkA1fsLUhCSWbnemBIAR9CPkK1Ra1LlYZcrAKm/Ymvqn" + }, + "mode_info": { + "single": { + "mode": "SIGN_MODE_DIRECT" + } + }, + "sequence": "0" } - ] + ], + "fee": { + "amount": [], + "gas_limit": "200000", + "payer": "", + "granter": "" + }, + "tip": null }, - { - "address": "dydx1wau5mja7j7zdavtfq9lu7ejef05hm6ffenlcsn", - "coins": [ - { - "denom": "adv4tnt", - "amount": "1000000000000000000000000" - }, + "signatures": [ + "IWmBNPto7CR7GE5Qc/Vce6uRJvgmxAifUfnqsuk/9bU0a/efjPl9wCVqXoV4tBN5h8YUJTwtU7Ll2Lwiq7z9ew==" + ] + }, + { + "body": { + "messages": [ { - "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", - "amount": "100000000000000000" + "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", + "description": { + "moniker": "dave", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "commission": { + "rate": "1.000000000000000000", + "max_rate": "1.000000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "min_self_delegation": "1", + "delegator_address": "dydx1wau5mja7j7zdavtfq9lu7ejef05hm6ffenlcsn", + "validator_address": "dydxvaloper1wau5mja7j7zdavtfq9lu7ejef05hm6ffudfwmz", + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "yG29kRfZ/hgAE1I7uWjbKQJJL4/gX/05XBnfB+m196A=" + }, + "value": { + "denom": "adv4tnt", + "amount": "500000000000000000000000" + } } - ] + ], + "memo": "5882428984d83b03d0c907c1f0af343534987052@172.17.0.2:26656", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [] }, - { - "address": "dydx10fx7sy6ywd5senxae9dwytf8jxek3t2gcen2vs", - "coins": [ - { - "denom": "adv4tnt", - "amount": "1000000000000000000000000" - }, + "auth_info": { + "signer_infos": [ { - "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", - "amount": "100000000000000000" + "public_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "A87MchHGMj7i1xBwUfECtXzXJIgli/JVFoSaxUqIN86R" + }, + "mode_info": { + "single": { + "mode": "SIGN_MODE_DIRECT" + } + }, + "sequence": "0" } - ] + ], + "fee": { + "amount": [], + "gas_limit": "200000", + "payer": "", + "granter": "" + }, + "tip": null }, - { - "address": "dydx1nzuttarf5k2j0nug5yzhr6p74t9avehn9hlh8m", - "coins": [ - { - "denom": "adv4tnt", - "amount": "1000000000000000000000000" - }, + "signatures": [ + "PbkEltEhqvhavA99UFdnI1IoRPw/8mKAR/Wif4zNRDwCPs19Yu0GitohSQVAxJGs3xK9whKmGIJoQQd8cYQz+Q==" + ] + }, + { + "body": { + "messages": [ { - "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", - "amount": "900000000000000000" + "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", + "description": { + "moniker": "bob", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "commission": { + "rate": "1.000000000000000000", + "max_rate": "1.000000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "min_self_delegation": "1", + "delegator_address": "dydx10fx7sy6ywd5senxae9dwytf8jxek3t2gcen2vs", + "validator_address": "dydxvaloper10fx7sy6ywd5senxae9dwytf8jxek3t2ga89u8p", + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "+P8YiogqqQY+iD96yEa9OJx6EgieU95u9eR3pzxfDp0=" + }, + "value": { + "denom": "adv4tnt", + "amount": "500000000000000000000000" + } } - ] + ], + "memo": "b69182310be02559483e42c77b7b104352713166@172.17.0.2:26656", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [] }, - { - "address": "dydx1ltyc6y4skclzafvpznpt2qjwmfwgsndp458rmp", - "coins": [ + "auth_info": { + "signer_infos": [ { - "denom": "adv4tnt", - "amount": "200000000000000000000000000" + "public_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "AlamQtNuTEHlCbn4ZQ20em/bbQNcaAJO54yMOCoE8OTy" + }, + "mode_info": { + "single": { + "mode": "SIGN_MODE_DIRECT" + } + }, + "sequence": "0" } - ] + ], + "fee": { + "amount": [], + "gas_limit": "200000", + "payer": "", + "granter": "" + }, + "tip": null + }, + "signatures": [ + "Hoo2es537f4zoxDFfrIbhPPBvWIiWudssh34cdidg7NnckC8bl8o+cWsdRP8BO/JkwT67Tn7vQXV+RHU6H5opw==" + ] + } + ] + }, + "gov": { + "constitution": "", + "deposits": [], + "params": { + "burn_proposal_deposit_prevote": false, + "burn_vote_quorum": false, + "burn_vote_veto": true, + "expedited_min_deposit": [ + { + "amount": "50000000", + "denom": "adv4tnt" } ], - "supply": [], - "denom_metadata": [ + "expedited_threshold": "0.75000", + "expedited_voting_period": "60s", + "max_deposit_period": "300s", + "min_deposit": [ { - "description": "The native token of the network", - "denom_units": [ - { - "denom": "adv4tnt", - "exponent": 0, - "aliases": [] - }, - { - "denom": "dv4tnt", - "exponent": 18, - "aliases": [] - } - ], - "base": "adv4tnt", - "display": "dv4tnt", - "name": "dYdX V4 Testnet Token", - "symbol": "dv4tnt", - "uri": "", - "uri_hash": "" + "amount": "10000000", + "denom": "adv4tnt" } ], - "send_enabled": [] + "min_deposit_ratio": "0.010000000000000000", + "min_initial_deposit_ratio": "0.20000", + "proposal_cancel_dest": "", + "proposal_cancel_ratio": "1", + "quorum": "0.334000000000000000", + "threshold": "0.500000000000000000", + "veto_threshold": "0.334000000000000000", + "voting_period": "300s" + }, + "proposals": [], + "starting_proposal_id": "1", + "votes": [] + }, + "govplus": {}, + "ibc": { + "channel_genesis": { + "ack_sequences": [], + "acknowledgements": [], + "channels": [], + "commitments": [], + "next_channel_sequence": "0", + "receipts": [], + "recv_sequences": [], + "send_sequences": [] }, - "blocktime": { + "client_genesis": { + "clients": [], + "clients_consensus": [], + "clients_metadata": [], + "create_localhost": false, + "next_client_sequence": "0", "params": { - "durations": [ - "300s", - "1800s" + "allowed_clients": [ + "07-tendermint" ] } }, - "bridge": { - "acknowledged_event_info": { - "eth_block_height": 4322136, - "next_id": 5 - }, - "event_params": { - "denom": "adv4tnt", - "eth_address": "0xf75012c350e4ad55be2048bd67ce6e03b20de82d", - "eth_chain_id": 11155111 - }, - "propose_params": { - "max_bridges_per_block": 10, - "propose_delay_duration": "60s", - "skip_if_block_delayed_by_duration": "5s", - "skip_rate_ppm": 800000 - }, - "safety_params": { - "delay_blocks": 30, - "is_disabled": false + "connection_genesis": { + "client_connection_paths": [], + "connections": [], + "next_connection_sequence": "0", + "params": { + "max_expected_time_per_block": "30000000000" } + } + }, + "interchainaccounts": { + "controller_genesis_state": { + "active_channels": [], + "interchain_accounts": [], + "params": { + "controller_enabled": false + }, + "ports": [] }, - "capability": { - "index": "1", - "owners": [] - }, - "clob": { - "block_rate_limit_config": { - "max_short_term_order_cancellations_per_n_blocks": [ - { - "limit": 200, - "num_blocks": 1 - } - ], - "max_short_term_orders_per_n_blocks": [ - { - "limit": 200, - "num_blocks": 1 - } + "host_genesis_state": { + "active_channels": [], + "interchain_accounts": [], + "params": { + "allow_messages": [ + "/ibc.applications.transfer.v1.MsgTransfer", + "/cosmos.bank.v1beta1.MsgSend", + "/cosmos.staking.v1beta1.MsgDelegate", + "/cosmos.staking.v1beta1.MsgBeginRedelegate", + "/cosmos.staking.v1beta1.MsgUndelegate", + "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", + "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + "/cosmos.gov.v1.MsgVote" ], - "max_stateful_orders_per_n_blocks": [ - { - "limit": 2, - "num_blocks": 1 - }, - { - "limit": 20, - "num_blocks": 100 - } - ] + "host_enabled": true }, - "clob_pairs": [ - { + "port": "icahost" + } + }, + "perpetuals": { + "liquidity_tiers": [ + { + "base_position_notional": 1000000000000, + "id": 0, + "impact_notional": 10000000000, + "initial_margin_ppm": 50000, + "maintenance_fraction_ppm": 600000, + "name": "Large-Cap" + }, + { + "base_position_notional": 250000000000, + "id": 1, + "impact_notional": 5000000000, + "initial_margin_ppm": 100000, + "maintenance_fraction_ppm": 500000, + "name": "Mid-Cap" + }, + { + "base_position_notional": 100000000000, + "id": 2, + "impact_notional": 2500000000, + "initial_margin_ppm": 200000, + "maintenance_fraction_ppm": 500000, + "name": "Long-Tail" + }, + { + "base_position_notional": 1000000000, + "id": 3, + "impact_notional": 2500000000, + "initial_margin_ppm": 1000000, + "maintenance_fraction_ppm": 200000, + "name": "Safety" + } + ], + "params": { + "funding_rate_clamp_factor_ppm": 6000000, + "min_num_votes_per_sample": 15, + "premium_vote_clamp_factor_ppm": 60000000 + }, + "perpetuals": [ + { + "params": { + "atomic_resolution": -10, + "default_funding_ppm": 0, "id": 0, - "perpetual_clob_metadata": { - "perpetual_id": 0 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 100000 - }, - { + "liquidity_tier": 0, + "market_id": 0, + "ticker": "BTC-USD" + } + }, + { + "params": { + "atomic_resolution": -9, + "default_funding_ppm": 0, "id": 1, - "perpetual_clob_metadata": { - "perpetual_id": 1 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 100000 - }, - { - "id": 2, - "perpetual_clob_metadata": { - "perpetual_id": 2 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 0, + "market_id": 1, + "ticker": "ETH-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, + "id": 2, + "liquidity_tier": 1, + "market_id": 2, + "ticker": "LINK-USD" + } + }, + { + "params": { + "atomic_resolution": -5, + "default_funding_ppm": 0, "id": 3, - "perpetual_clob_metadata": { - "perpetual_id": 3 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 3, + "ticker": "MATIC-USD" + } + }, + { + "params": { + "atomic_resolution": -5, + "default_funding_ppm": 0, "id": 4, - "perpetual_clob_metadata": { - "perpetual_id": 4 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 4, + "ticker": "CRV-USD" + } + }, + { + "params": { + "atomic_resolution": -7, + "default_funding_ppm": 0, "id": 5, - "perpetual_clob_metadata": { - "perpetual_id": 5 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 5, + "ticker": "SOL-USD" + } + }, + { + "params": { + "atomic_resolution": -5, + "default_funding_ppm": 0, "id": 6, - "perpetual_clob_metadata": { - "perpetual_id": 6 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 6, + "ticker": "ADA-USD" + } + }, + { + "params": { + "atomic_resolution": -7, + "default_funding_ppm": 0, "id": 7, - "perpetual_clob_metadata": { - "perpetual_id": 7 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 7, + "ticker": "AVAX-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 8, - "perpetual_clob_metadata": { - "perpetual_id": 8 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 8, + "ticker": "FIL-USD" + } + }, + { + "params": { + "atomic_resolution": -7, + "default_funding_ppm": 0, "id": 9, - "perpetual_clob_metadata": { - "perpetual_id": 9 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 9, + "ticker": "LTC-USD" + } + }, + { + "params": { + "atomic_resolution": -4, + "default_funding_ppm": 0, "id": 10, - "perpetual_clob_metadata": { - "perpetual_id": 10 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 10, + "ticker": "DOGE-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 11, - "perpetual_clob_metadata": { - "perpetual_id": 11 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 11, + "ticker": "ATOM-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 12, - "perpetual_clob_metadata": { - "perpetual_id": 12 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 12, + "ticker": "DOT-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 13, - "perpetual_clob_metadata": { - "perpetual_id": 13 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 13, + "ticker": "UNI-USD" + } + }, + { + "params": { + "atomic_resolution": -8, + "default_funding_ppm": 0, "id": 14, - "perpetual_clob_metadata": { - "perpetual_id": 14 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 14, + "ticker": "BCH-USD" + } + }, + { + "params": { + "atomic_resolution": -4, + "default_funding_ppm": 0, "id": 15, - "perpetual_clob_metadata": { - "perpetual_id": 15 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 15, + "ticker": "TRX-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 16, - "perpetual_clob_metadata": { - "perpetual_id": 16 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 16, + "ticker": "NEAR-USD" + } + }, + { + "params": { + "atomic_resolution": -9, + "default_funding_ppm": 0, "id": 17, - "perpetual_clob_metadata": { - "perpetual_id": 17 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 2, + "market_id": 17, + "ticker": "MKR-USD" + } + }, + { + "params": { + "atomic_resolution": -5, + "default_funding_ppm": 0, "id": 18, - "perpetual_clob_metadata": { - "perpetual_id": 18 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 18, + "ticker": "XLM-USD" + } + }, + { + "params": { + "atomic_resolution": -7, + "default_funding_ppm": 0, "id": 19, - "perpetual_clob_metadata": { - "perpetual_id": 19 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 19, + "ticker": "ETC-USD" + } + }, + { + "params": { + "atomic_resolution": -7, + "default_funding_ppm": 0, "id": 20, - "perpetual_clob_metadata": { - "perpetual_id": 20 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 2, + "market_id": 20, + "ticker": "COMP-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 21, - "perpetual_clob_metadata": { - "perpetual_id": 21 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 21, + "ticker": "WLD-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 22, - "perpetual_clob_metadata": { - "perpetual_id": 22 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 2, + "market_id": 22, + "ticker": "APE-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 23, - "perpetual_clob_metadata": { - "perpetual_id": 23 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 23, + "ticker": "APT-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 24, - "perpetual_clob_metadata": { - "perpetual_id": 24 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 24, + "ticker": "ARB-USD" + } + }, + { + "params": { + "atomic_resolution": -5, + "default_funding_ppm": 0, "id": 25, - "perpetual_clob_metadata": { - "perpetual_id": 25 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 2, + "market_id": 25, + "ticker": "BLUR-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 26, - "perpetual_clob_metadata": { - "perpetual_id": 26 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 2, + "market_id": 26, + "ticker": "LDO-USD" + } + }, + { + "params": { + "atomic_resolution": -6, + "default_funding_ppm": 0, "id": 27, - "perpetual_clob_metadata": { - "perpetual_id": 27 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 27, + "ticker": "OP-USD" + } + }, + { + "params": { + "atomic_resolution": 1, + "default_funding_ppm": 0, "id": 28, - "perpetual_clob_metadata": { - "perpetual_id": 28 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 28, + "ticker": "PEPE-USD" + } + }, + { + "params": { + "atomic_resolution": -5, + "default_funding_ppm": 0, "id": 29, - "perpetual_clob_metadata": { - "perpetual_id": 29 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 2, + "market_id": 29, + "ticker": "SEI-USD" + } + }, + { + "params": { + "atomic_resolution": 0, + "default_funding_ppm": 0, "id": 30, - "perpetual_clob_metadata": { - "perpetual_id": 30 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { + "liquidity_tier": 1, + "market_id": 30, + "ticker": "SHIB-USD" + } + }, + { + "params": { + "atomic_resolution": -5, + "default_funding_ppm": 0, "id": 31, - "perpetual_clob_metadata": { - "perpetual_id": 31 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { - "id": 32, - "perpetual_clob_metadata": { - "perpetual_id": 32 - }, - "quantum_conversion_exponent": -9, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 1000000 - }, - { - "id": 33, - "perpetual_clob_metadata": { - "perpetual_id": 33 - }, - "quantum_conversion_exponent": -8, - "status": "STATUS_ACTIVE", - "step_base_quantums": 1000000, - "subticks_per_tick": 100 + "liquidity_tier": 1, + "market_id": 31, + "ticker": "SUI-USD" } - ], - "equity_tier_limit_config": { - "short_term_order_equity_tiers": [ - { - "limit": 0, - "usd_tnc_required": "0" - }, - { - "limit": 1, - "usd_tnc_required": "20000000" - }, - { - "limit": 5, - "usd_tnc_required": "100000000" - }, - { - "limit": 10, - "usd_tnc_required": "1000000000" - }, - { - "limit": 100, - "usd_tnc_required": "10000000000" - }, - { - "limit": 1000, - "usd_tnc_required": "100000000000" - } - ], - "stateful_order_equity_tiers": [ - { - "limit": 0, - "usd_tnc_required": "0" - }, - { - "limit": 1, - "usd_tnc_required": "20000000" - }, - { - "limit": 5, - "usd_tnc_required": "100000000" - }, - { - "limit": 10, - "usd_tnc_required": "1000000000" - }, - { - "limit": 100, - "usd_tnc_required": "10000000000" - }, - { - "limit": 200, - "usd_tnc_required": "100000000000" - } - ] }, - "liquidations_config": { - "fillable_price_config": { - "bankruptcy_adjustment_ppm": 1000000, - "spread_to_maintenance_margin_ratio_ppm": 1500000 - }, - "max_liquidation_fee_ppm": 15000, - "position_block_limits": { - "max_position_portion_liquidated_ppm": 100000, - "min_position_notional_liquidated": 1000000000 - }, - "subaccount_block_limits": { - "max_notional_liquidated": 100000000000, - "max_quantums_insurance_lost": 1000000000000 + { + "params": { + "atomic_resolution": -5, + "default_funding_ppm": 0, + "id": 32, + "liquidity_tier": 1, + "market_id": 32, + "ticker": "XRP-USD" } } - }, - "crisis": { - "constant_fee": { - "amount": "1000", - "denom": "adv4tnt" - } - }, - "delaymsg": { - "delayed_messages": [ - { - "block_height": 378000, - "id": 0, - "msg": { - "@type": "/dydxprotocol.feetiers.MsgUpdatePerpetualFeeParams", - "authority": "dydx1mkkvp26dngu6n8rmalaxyp3gwkjuzztq5zx6tr", - "params": { - "tiers": [ - { - "absolute_volume_requirement": "0", - "maker_fee_ppm": 100, - "maker_volume_share_requirement_ppm": 0, - "name": "1", - "taker_fee_ppm": 500, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "1000000000000", - "maker_fee_ppm": 100, - "maker_volume_share_requirement_ppm": 0, - "name": "2", - "taker_fee_ppm": 450, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "5000000000000", - "maker_fee_ppm": 50, - "maker_volume_share_requirement_ppm": 0, - "name": "3", - "taker_fee_ppm": 400, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "25000000000000", - "maker_fee_ppm": 0, - "maker_volume_share_requirement_ppm": 0, - "name": "4", - "taker_fee_ppm": 350, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": 0, - "maker_volume_share_requirement_ppm": 0, - "name": "5", - "taker_fee_ppm": 300, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": -50, - "maker_volume_share_requirement_ppm": 0, - "name": "6", - "taker_fee_ppm": 250, - "total_volume_share_requirement_ppm": 5000 - }, - { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": -70, - "maker_volume_share_requirement_ppm": 10000, - "name": "7", - "taker_fee_ppm": 250, - "total_volume_share_requirement_ppm": 5000 - }, - { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": -90, - "maker_volume_share_requirement_ppm": 20000, - "name": "8", - "taker_fee_ppm": 250, - "total_volume_share_requirement_ppm": 5000 - }, - { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 40000, - "name": "9", - "taker_fee_ppm": 250, - "total_volume_share_requirement_ppm": 5000 - } - ] - } - } - } - ], - "next_delayed_message_id": 1 - }, - "distribution": { - "delegator_starting_infos": [], - "delegator_withdraw_infos": [], - "fee_pool": { - "community_pool": [] + ] + }, + "prices": { + "market_params": [ + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"BTCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"BTCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"BTC-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"btcusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XXBTZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"BTC-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"BTC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"BTC-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -5, + "id": 0, + "min_exchanges": 3, + "min_price_change_ppm": 1000, + "pair": "BTC-USD" }, - "outstanding_rewards": [], - "params": { - "base_proposer_reward": "0.000000000000000000", - "bonus_proposer_reward": "0.000000000000000000", - "community_tax": "0.020000000000000000", - "withdraw_addr_enabled": true - }, - "previous_proposer": "", - "validator_accumulated_commissions": [], - "validator_current_rewards": [], - "validator_historical_rewards": [], - "validator_slash_events": [] - }, - "epochs": { - "epoch_info_list": [ - { - "current_epoch": 0, - "current_epoch_start_block": 0, - "duration": 60, - "fast_forward_next_tick": true, - "is_initialized": false, - "name": "funding-sample", - "next_tick": 30 - }, - { - "current_epoch": 0, - "current_epoch_start_block": 0, - "duration": 3600, - "fast_forward_next_tick": true, - "is_initialized": false, - "name": "funding-tick", - "next_tick": 0 - }, - { - "current_epoch": 0, - "current_epoch_start_block": 0, - "duration": 3600, - "fast_forward_next_tick": true, - "is_initialized": false, - "name": "stats-epoch", - "next_tick": 0 - } - ] - }, - "evidence": { - "evidence": [] - }, - "feegrant": { - "allowances": [] - }, - "feetiers": { - "params": { - "tiers": [ - { - "absolute_volume_requirement": "0", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 0, - "name": "1", - "taker_fee_ppm": 500, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "1000000000000", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 0, - "name": "2", - "taker_fee_ppm": 450, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "5000000000000", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 0, - "name": "3", - "taker_fee_ppm": 400, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "25000000000000", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 0, - "name": "4", - "taker_fee_ppm": 350, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 0, - "name": "5", - "taker_fee_ppm": 300, - "total_volume_share_requirement_ppm": 0 - }, - { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 0, - "name": "6", - "taker_fee_ppm": 250, - "total_volume_share_requirement_ppm": 5000 - }, - { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 10000, - "name": "7", - "taker_fee_ppm": 250, - "total_volume_share_requirement_ppm": 5000 - }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ETHUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"ETHUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ETH-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"ethusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XETHZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ETH-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ETH_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ETH-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -6, + "id": 1, + "min_exchanges": 3, + "min_price_change_ppm": 1000, + "pair": "ETH-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"LINKUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"LINKUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"LINK-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"LINKUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"LINK-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"LINK_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"LINK-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 2, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "LINK-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"MATICUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"MATICUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"MATIC-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"MATIC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"maticusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"MATICUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"MATIC-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"MATIC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"MATIC-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -10, + "id": 3, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "MATIC-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"CRVUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"CRV-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"CRV_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"CRVUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"CRV-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"CRV_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"CRV-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -10, + "id": 4, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "CRV-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"SOLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"SOLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"SOL-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"solusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"SOLUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"SOL-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"SOL_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"SOL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -8, + "id": 5, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "SOL-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ADAUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"ADAUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ADA-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"ADA_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"adausdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"ADAUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ADA-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ADA_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ADA-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -10, + "id": 6, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "ADA-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"AVAXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"AVAXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"AVAX-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"AVAX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"avaxusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"AVAXUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"AVAX-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"AVAX-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -8, + "id": 7, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "AVAX-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"FILUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"FIL-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"FIL_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"filusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"FILUSD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"FIL_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"FIL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 8, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "FIL-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"LTCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"LTCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"LTC-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"ltcusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XLTCZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"LTC-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"LTC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"LTC-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -8, + "id": 9, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "LTC-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"DOGEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"DOGEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"DOGE-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"DOGE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"dogeusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XDGUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"DOGE-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"DOGE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"DOGE-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -11, + "id": 10, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "DOGE-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ATOMUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"ATOMUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ATOM-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"ATOM_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"ATOMUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ATOM-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ATOM_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ATOM-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 11, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "ATOM-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"DOTUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"DOTUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"DOT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"DOT_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"DOTUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"DOT-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"DOT_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"DOT-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 12, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "DOT-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"UNIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"UNIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"UNI-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"UNI_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"UNIUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"UNI-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"UNI-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 13, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "UNI-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"BCHUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"BCHUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"BCH-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"BCH_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"bchusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"BCHUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"BCH-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"BCH_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"BCH-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -7, + "id": 14, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "BCH-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"TRXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"TRXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"TRX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"trxusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"TRXUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"TRX-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"TRX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"TRX-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -11, + "id": 15, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "TRX-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"NEARUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"NEAR-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"NEAR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"nearusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"NEAR-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"NEAR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"NEAR-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 16, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "NEAR-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"MKRUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"MKR-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"MKRUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"MKR-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"MKR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"MKR-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -6, + "id": 17, + "min_exchanges": 3, + "min_price_change_ppm": 4000, + "pair": "MKR-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"XLMUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"XLMUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"XLM-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XXLMZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"XLM-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"XLM_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"XLM-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -10, + "id": 18, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "XLM-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ETCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ETC-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"ETC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"etcusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ETC-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ETC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ETC-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -8, + "id": 19, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "ETC-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"COMPUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"COMP-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"COMP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"COMPUSD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"COMP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"COMP-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -8, + "id": 20, + "min_exchanges": 3, + "min_price_change_ppm": 4000, + "pair": "COMP-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"WLDUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"WLDUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"WLD_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"wldusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"WLD-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"WLD_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"WLD-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 21, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "WLD-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"APEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"APE-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"APE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"APEUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"APE-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"APE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"APE-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 22, + "min_exchanges": 3, + "min_price_change_ppm": 4000, + "pair": "APE-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"APTUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"APTUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"APT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"APT_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"aptusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"APT-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"APT_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"APT-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 23, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "APT-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ARBUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"ARBUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ARB-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"ARB_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"arbusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ARB-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ARB_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ARB-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 24, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "ARB-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"BLUR-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"BLUR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"BLURUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"BLUR-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"BLUR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"BLUR-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -10, + "id": 25, + "min_exchanges": 3, + "min_price_change_ppm": 4000, + "pair": "BLUR-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"LDOUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"LDO-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"LDOUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"LDO-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"LDO_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"LDO-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 26, + "min_exchanges": 3, + "min_price_change_ppm": 4000, + "pair": "LDO-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"OPUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"OP-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"OP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"OP-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"OP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"OP-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 27, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "OP-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"PEPEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"PEPEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"PEPE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"PEPEUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"PEPE-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"PEPE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"PEPE-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -16, + "id": 28, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "PEPE-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"SEIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"SEIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"SEI-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"SEI_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"seiusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"SEI-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"SEI_USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -10, + "id": 29, + "min_exchanges": 3, + "min_price_change_ppm": 4000, + "pair": "SEI-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"SHIBUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"SHIBUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"SHIB-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"SHIB_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"SHIBUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"SHIB-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"SHIB_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"SHIB-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -15, + "id": 30, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "SHIB-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"SUIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"SUIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"SUI-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"SUI_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"suiusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"SUI-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"SUI_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"SUI-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -10, + "id": 31, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "SUI-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"XRPUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"XRPUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"XRP-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"XRP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"xrpusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XXRPZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"XRP-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"XRP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"XRP-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -10, + "id": 32, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "XRP-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"USDCUSDT\",\"invert\":true},{\"exchangeName\":\"Bybit\",\"ticker\":\"USDCUSDT\",\"invert\":true},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"ethusdt\",\"adjustByMarket\":\"ETH-USD\",\"invert\":true},{\"exchangeName\":\"Kraken\",\"ticker\":\"USDTZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"BTC-USDT\",\"adjustByMarket\":\"BTC-USD\",\"invert\":true},{\"exchangeName\":\"Okx\",\"ticker\":\"USDC-USDT\",\"invert\":true}]}", + "exponent": -9, + "id": 1000000, + "min_exchanges": 3, + "min_price_change_ppm": 1000, + "pair": "USDT-USD" + }, + { + "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"DYDXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"DYDXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"DYDX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"DYDX-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"DYDX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"DYDX-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", + "exponent": -9, + "id": 1000001, + "min_exchanges": 3, + "min_price_change_ppm": 2500, + "pair": "DYDX-USD" + } + ], + "market_prices": [ + { + "exponent": -5, + "id": 0, + "price": 2868819524 + }, + { + "exponent": -6, + "id": 1, + "price": 1811985252 + }, + { + "exponent": -9, + "id": 2, + "price": 7204646989 + }, + { + "exponent": -10, + "id": 3, + "price": 6665746387 + }, + { + "exponent": -10, + "id": 4, + "price": 6029316660 + }, + { + "exponent": -8, + "id": 5, + "price": 2350695125 + }, + { + "exponent": -10, + "id": 6, + "price": 2918831290 + }, + { + "exponent": -8, + "id": 7, + "price": 1223293720 + }, + { + "exponent": -9, + "id": 8, + "price": 4050336602 + }, + { + "exponent": -8, + "id": 9, + "price": 8193604950 + }, + { + "exponent": -11, + "id": 10, + "price": 7320836895 + }, + { + "exponent": -9, + "id": 11, + "price": 8433494428 + }, + { + "exponent": -9, + "id": 12, + "price": 4937186533 + }, + { + "exponent": -9, + "id": 13, + "price": 5852293356 + }, + { + "exponent": -7, + "id": 14, + "price": 2255676327 + }, + { + "exponent": -11, + "id": 15, + "price": 7795369902 + }, + { + "exponent": -9, + "id": 16, + "price": 1312325536 + }, + { + "exponent": -6, + "id": 17, + "price": 1199517382 + }, + { + "exponent": -10, + "id": 18, + "price": 1398578933 + }, + { + "exponent": -8, + "id": 19, + "price": 1741060746 + }, + { + "exponent": -8, + "id": 20, + "price": 5717635307 + }, + { + "exponent": -9, + "id": 21, + "price": 1943019371 + }, + { + "exponent": -9, + "id": 22, + "price": 1842365656 + }, + { + "exponent": -9, + "id": 23, + "price": 6787621897 + }, + { + "exponent": -9, + "id": 24, + "price": 1127629325 + }, + { + "exponent": -10, + "id": 25, + "price": 2779565892 + }, + { + "exponent": -9, + "id": 26, + "price": 1855061997 + }, + { + "exponent": -9, + "id": 27, + "price": 1562218603 + }, + { + "exponent": -16, + "id": 28, + "price": 2481900353 + }, + { + "exponent": -10, + "id": 29, + "price": 1686998025 + }, + { + "exponent": -15, + "id": 30, + "price": 8895882688 + }, + { + "exponent": -10, + "id": 31, + "price": 5896318772 + }, + { + "exponent": -10, + "id": 32, + "price": 6327613800 + }, + { + "exponent": -9, + "id": 1000000, + "price": 1000000000 + }, + { + "exponent": -9, + "id": 1000001, + "price": 2050000000 + } + ] + }, + "ratelimit": { + "limit_params_list": [ + { + "denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5", + "limiters": [ { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 20000, - "name": "8", - "taker_fee_ppm": 250, - "total_volume_share_requirement_ppm": 5000 + "baseline_minimum": "1000000000000", + "baseline_tvl_ppm": 10000, + "period": "3600s" }, { - "absolute_volume_requirement": "125000000000000", - "maker_fee_ppm": -110, - "maker_volume_share_requirement_ppm": 40000, - "name": "9", - "taker_fee_ppm": 250, - "total_volume_share_requirement_ppm": 5000 + "baseline_minimum": "10000000000000", + "baseline_tvl_ppm": 100000, + "period": "86400s" } ] } + ] + }, + "rewards": { + "params": { + "denom": "adv4tnt", + "denom_exponent": -18, + "fee_multiplier_ppm": 990000, + "market_id": 11, + "treasury_account": "rewards_treasury" + } + }, + "sending": {}, + "slashing": { + "missed_blocks": [], + "params": { + "downtime_jail_duration": "60s", + "min_signed_per_window": "0.050000000000000000", + "signed_blocks_window": "3000", + "slash_fraction_double_sign": "0.000000000000000000", + "slash_fraction_downtime": "0.000000000000000000" }, - "genutil": { - "gen_txs": [ - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "alice", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "1.000000000000000000", - "max_rate": "1.000000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4", - "validator_address": "dydxvaloper199tqg4wdlnu4qjlxchpd7seg454937hjxg9yhy", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "YiARx8259Z+fGFUxQLrz/5FU2RYRT6f5yzvt7D7CrQM=" - }, - "value": { - "denom": "adv4tnt", - "amount": "500000000000000000000000" - } - } - ], - "memo": "17e5e45691f0d01449c84fd4ae87279578cdd7ec@172.17.0.2:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A0iQ+HpUfJGcgcH7iiEzY9VwCYWCTwg5LsTjc/q1XwSc" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [ - "OPf+X9U5GJwJOeTpBgW4HBpEP9PEivbMoUzy3WZiriMEghRJLuP3LGVpp4ePr8tEBoEEDFFu11ThiiyzjcmxIQ==" - ] - }, - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "carl", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "1.000000000000000000", - "max_rate": "1.000000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "dydx1fjg6zp6vv8t9wvy4lps03r5l4g7tkjw9wvmh70", - "validator_address": "dydxvaloper1fjg6zp6vv8t9wvy4lps03r5l4g7tkjw9tjdp47", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "ytLfs1W6E2I41iteKC/YwjyZ/51+CAYCHYxmRHiBeY4=" - }, - "value": { - "denom": "adv4tnt", - "amount": "500000000000000000000000" - } - } - ], - "memo": "47539956aaa8e624e0f1d926040e54908ad0eb44@172.17.0.2:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "AkA1fsLUhCSWbnemBIAR9CPkK1Ra1LlYZcrAKm/Ymvqn" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [ - "IWmBNPto7CR7GE5Qc/Vce6uRJvgmxAifUfnqsuk/9bU0a/efjPl9wCVqXoV4tBN5h8YUJTwtU7Ll2Lwiq7z9ew==" - ] - }, - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "dave", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "1.000000000000000000", - "max_rate": "1.000000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "dydx1wau5mja7j7zdavtfq9lu7ejef05hm6ffenlcsn", - "validator_address": "dydxvaloper1wau5mja7j7zdavtfq9lu7ejef05hm6ffudfwmz", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "yG29kRfZ/hgAE1I7uWjbKQJJL4/gX/05XBnfB+m196A=" - }, - "value": { - "denom": "adv4tnt", - "amount": "500000000000000000000000" - } - } - ], - "memo": "5882428984d83b03d0c907c1f0af343534987052@172.17.0.2:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A87MchHGMj7i1xBwUfECtXzXJIgli/JVFoSaxUqIN86R" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [ - "PbkEltEhqvhavA99UFdnI1IoRPw/8mKAR/Wif4zNRDwCPs19Yu0GitohSQVAxJGs3xK9whKmGIJoQQd8cYQz+Q==" - ] - }, - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "bob", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "1.000000000000000000", - "max_rate": "1.000000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "dydx10fx7sy6ywd5senxae9dwytf8jxek3t2gcen2vs", - "validator_address": "dydxvaloper10fx7sy6ywd5senxae9dwytf8jxek3t2ga89u8p", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "+P8YiogqqQY+iD96yEa9OJx6EgieU95u9eR3pzxfDp0=" - }, - "value": { - "denom": "adv4tnt", - "amount": "500000000000000000000000" - } - } - ], - "memo": "b69182310be02559483e42c77b7b104352713166@172.17.0.2:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "AlamQtNuTEHlCbn4ZQ20em/bbQNcaAJO54yMOCoE8OTy" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [ - "Hoo2es537f4zoxDFfrIbhPPBvWIiWudssh34cdidg7NnckC8bl8o+cWsdRP8BO/JkwT67Tn7vQXV+RHU6H5opw==" - ] - } - ] + "signing_infos": [] + }, + "staking": { + "delegations": [], + "exported": false, + "last_total_power": "0", + "last_validator_powers": [], + "params": { + "bond_denom": "adv4tnt", + "historical_entries": 10000, + "max_entries": 7, + "max_validators": 100, + "min_commission_rate": "0.000000000000000000", + "unbonding_time": "1814400s" }, - "gov": { - "deposits": [], - "params": { - "burn_proposal_deposit_prevote": false, - "burn_vote_quorum": false, - "burn_vote_veto": true, - "max_deposit_period": "300s", - "min_deposit": [ + "redelegations": [], + "unbonding_delegations": [], + "validators": [] + }, + "stats": { + "params": { + "window_duration": "2592000s" + } + }, + "subaccounts": { + "subaccounts": [ + { + "asset_positions": [ { - "amount": "10000000", - "denom": "adv4tnt" + "asset_id": 0, + "index": 0, + "quantums": "100000000000000000" } ], - "min_initial_deposit_ratio": "0.20000", - "quorum": "0.334000000000000000", - "threshold": "0.500000000000000000", - "veto_threshold": "0.334000000000000000", - "voting_period": "300s" - }, - "proposals": [], - "starting_proposal_id": "1", - "votes": [] - }, - "ibc": { - "channel_genesis": { - "ack_sequences": [], - "acknowledgements": [], - "channels": [], - "commitments": [], - "next_channel_sequence": "0", - "receipts": [], - "recv_sequences": [], - "send_sequences": [] - }, - "client_genesis": { - "clients": [], - "clients_consensus": [], - "clients_metadata": [], - "create_localhost": false, - "next_client_sequence": "0", - "params": { - "allowed_clients": [ - "07-tendermint" - ] - } - }, - "connection_genesis": { - "client_connection_paths": [], - "connections": [], - "next_connection_sequence": "0", - "params": { - "max_expected_time_per_block": "30000000000" - } - } - }, - "interchainaccounts": { - "controller_genesis_state": { - "active_channels": [], - "interchain_accounts": [], - "params": { - "controller_enabled": false + "id": { + "number": 0, + "owner": "dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4" }, - "ports": [] + "margin_enabled": true }, - "host_genesis_state": { - "active_channels": [], - "interchain_accounts": [], - "params": { - "allow_messages": [ - "/ibc.applications.transfer.v1.MsgTransfer", - "/cosmos.bank.v1beta1.MsgSend", - "/cosmos.staking.v1beta1.MsgDelegate", - "/cosmos.staking.v1beta1.MsgBeginRedelegate", - "/cosmos.staking.v1beta1.MsgUndelegate", - "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", - "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", - "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", - "/cosmos.distribution.v1beta1.MsgFundCommunityPool", - "/cosmos.gov.v1.MsgVote" - ], - "host_enabled": true + { + "asset_positions": [ + { + "asset_id": 0, + "index": 0, + "quantums": "900000000000000000" + } + ], + "id": { + "number": 0, + "owner": "dydx1nzuttarf5k2j0nug5yzhr6p74t9avehn9hlh8m" }, - "port": "icahost" + "margin_enabled": true } + ] + }, + "transfer": { + "denom_traces": [], + "params": { + "receive_enabled": true, + "send_enabled": true }, - "perpetuals": { - "liquidity_tiers": [ - { - "base_position_notional": 1000000000000, - "id": 0, - "impact_notional": 10000000000, - "initial_margin_ppm": 50000, - "maintenance_fraction_ppm": 600000, - "name": "Large-Cap" - }, - { - "base_position_notional": 250000000000, - "id": 1, - "impact_notional": 5000000000, - "initial_margin_ppm": 100000, - "maintenance_fraction_ppm": 500000, - "name": "Mid-Cap" - }, - { - "base_position_notional": 100000000000, - "id": 2, - "impact_notional": 2500000000, - "initial_margin_ppm": 200000, - "maintenance_fraction_ppm": 500000, - "name": "Long-Tail" - }, - { - "base_position_notional": 1000000000, - "id": 3, - "impact_notional": 2500000000, - "initial_margin_ppm": 1000000, - "maintenance_fraction_ppm": 200000, - "name": "Safety" - }, - { - "base_position_notional": 1000000000039, - "id": 4, - "impact_notional": 50000000000, - "initial_margin_ppm": 10007, - "maintenance_fraction_ppm": 500009, - "name": "test-usd-100x-liq-tier-linear" - }, - { - "base_position_notional": 100000007, - "id": 5, - "impact_notional": 50000000000, - "initial_margin_ppm": 10007, - "maintenance_fraction_ppm": 500009, - "name": "test-usd-100x-liq-tier-nonlinear" - } - ], - "params": { - "funding_rate_clamp_factor_ppm": 6000000, - "min_num_votes_per_sample": 15, - "premium_vote_clamp_factor_ppm": 60000000 + "port_id": "transfer", + "total_escrowed": [] + }, + "upgrade": {}, + "vest": { + "vest_entries": [ + { + "denom": "adv4tnt", + "end_time": "2025-01-01T00:00:00Z", + "start_time": "2023-01-01T00:00:00Z", + "treasury_account": "community_treasury", + "vester_account": "community_vester" }, - "perpetuals": [ - { - "params": { - "atomic_resolution": -10, - "default_funding_ppm": 0, - "id": 0, - "liquidity_tier": 0, - "market_id": 0, - "ticker": "BTC-USD" - } - }, - { - "params": { - "atomic_resolution": -9, - "default_funding_ppm": 0, - "id": 1, - "liquidity_tier": 0, - "market_id": 1, - "ticker": "ETH-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 2, - "liquidity_tier": 1, - "market_id": 2, - "ticker": "LINK-USD" - } - }, - { - "params": { - "atomic_resolution": -5, - "default_funding_ppm": 0, - "id": 3, - "liquidity_tier": 1, - "market_id": 3, - "ticker": "MATIC-USD" - } - }, - { - "params": { - "atomic_resolution": -5, - "default_funding_ppm": 0, - "id": 4, - "liquidity_tier": 1, - "market_id": 4, - "ticker": "CRV-USD" - } - }, - { - "params": { - "atomic_resolution": -7, - "default_funding_ppm": 0, - "id": 5, - "liquidity_tier": 1, - "market_id": 5, - "ticker": "SOL-USD" - } - }, - { - "params": { - "atomic_resolution": -5, - "default_funding_ppm": 0, - "id": 6, - "liquidity_tier": 1, - "market_id": 6, - "ticker": "ADA-USD" - } - }, - { - "params": { - "atomic_resolution": -7, - "default_funding_ppm": 0, - "id": 7, - "liquidity_tier": 1, - "market_id": 7, - "ticker": "AVAX-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 8, - "liquidity_tier": 1, - "market_id": 8, - "ticker": "FIL-USD" - } - }, - { - "params": { - "atomic_resolution": -7, - "default_funding_ppm": 0, - "id": 9, - "liquidity_tier": 1, - "market_id": 9, - "ticker": "LTC-USD" - } - }, - { - "params": { - "atomic_resolution": -4, - "default_funding_ppm": 0, - "id": 10, - "liquidity_tier": 1, - "market_id": 10, - "ticker": "DOGE-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 11, - "liquidity_tier": 1, - "market_id": 11, - "ticker": "ATOM-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 12, - "liquidity_tier": 1, - "market_id": 12, - "ticker": "DOT-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 13, - "liquidity_tier": 1, - "market_id": 13, - "ticker": "UNI-USD" - } - }, - { - "params": { - "atomic_resolution": -8, - "default_funding_ppm": 0, - "id": 14, - "liquidity_tier": 1, - "market_id": 14, - "ticker": "BCH-USD" - } - }, - { - "params": { - "atomic_resolution": -4, - "default_funding_ppm": 0, - "id": 15, - "liquidity_tier": 1, - "market_id": 15, - "ticker": "TRX-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 16, - "liquidity_tier": 1, - "market_id": 16, - "ticker": "NEAR-USD" - } - }, - { - "params": { - "atomic_resolution": -9, - "default_funding_ppm": 0, - "id": 17, - "liquidity_tier": 2, - "market_id": 17, - "ticker": "MKR-USD" - } - }, - { - "params": { - "atomic_resolution": -5, - "default_funding_ppm": 0, - "id": 18, - "liquidity_tier": 1, - "market_id": 18, - "ticker": "XLM-USD" - } - }, - { - "params": { - "atomic_resolution": -7, - "default_funding_ppm": 0, - "id": 19, - "liquidity_tier": 1, - "market_id": 19, - "ticker": "ETC-USD" - } - }, - { - "params": { - "atomic_resolution": -7, - "default_funding_ppm": 0, - "id": 20, - "liquidity_tier": 2, - "market_id": 20, - "ticker": "COMP-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 21, - "liquidity_tier": 1, - "market_id": 21, - "ticker": "WLD-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 22, - "liquidity_tier": 2, - "market_id": 22, - "ticker": "APE-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 23, - "liquidity_tier": 1, - "market_id": 23, - "ticker": "APT-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 24, - "liquidity_tier": 1, - "market_id": 24, - "ticker": "ARB-USD" - } - }, - { - "params": { - "atomic_resolution": -5, - "default_funding_ppm": 0, - "id": 25, - "liquidity_tier": 2, - "market_id": 25, - "ticker": "BLUR-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 26, - "liquidity_tier": 2, - "market_id": 26, - "ticker": "LDO-USD" - } - }, - { - "params": { - "atomic_resolution": -6, - "default_funding_ppm": 0, - "id": 27, - "liquidity_tier": 1, - "market_id": 27, - "ticker": "OP-USD" - } - }, - { - "params": { - "atomic_resolution": 1, - "default_funding_ppm": 0, - "id": 28, - "liquidity_tier": 1, - "market_id": 28, - "ticker": "PEPE-USD" - } - }, - { - "params": { - "atomic_resolution": -5, - "default_funding_ppm": 0, - "id": 29, - "liquidity_tier": 2, - "market_id": 29, - "ticker": "SEI-USD" - } - }, - { - "params": { - "atomic_resolution": 0, - "default_funding_ppm": 0, - "id": 30, - "liquidity_tier": 1, - "market_id": 30, - "ticker": "SHIB-USD" - } - }, - { - "params": { - "atomic_resolution": -5, - "default_funding_ppm": 0, - "id": 31, - "liquidity_tier": 1, - "market_id": 31, - "ticker": "SUI-USD" - } - }, - { - "params": { - "atomic_resolution": -5, - "default_funding_ppm": 0, - "id": 32, - "liquidity_tier": 1, - "market_id": 32, - "ticker": "XRP-USD" - } - }, - { - "params": { - "atomic_resolution": -10, - "default_funding_ppm": 0, - "id": 33, - "liquidity_tier": 4, - "market_id": 33, - "ticker": "TEST-USD" - } - } - ] - }, - "prices": { - "market_params": [ - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"BTCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"BTCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"BTC-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"btcusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XXBTZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"BTC-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"BTC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"BTC-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -5, - "id": 0, - "min_exchanges": 3, - "min_price_change_ppm": 1000, - "pair": "BTC-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ETHUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"ETHUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ETH-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"ethusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XETHZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ETH-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ETH_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ETH-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -6, - "id": 1, - "min_exchanges": 3, - "min_price_change_ppm": 1000, - "pair": "ETH-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"LINKUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"LINKUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"LINK-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"LINKUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"LINK-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"LINK_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"LINK-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 2, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "LINK-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"MATICUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"MATICUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"MATIC-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"MATIC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"maticusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"MATICUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"MATIC-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"MATIC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"MATIC-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -10, - "id": 3, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "MATIC-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"CRVUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"CRV-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"CRV_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"CRVUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"CRV-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"CRV_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"CRV-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -10, - "id": 4, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "CRV-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"SOLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"SOLUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"SOL-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"solusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"SOLUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"SOL-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"SOL_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"SOL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -8, - "id": 5, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "SOL-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ADAUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"ADAUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ADA-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"ADA_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"adausdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"ADAUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ADA-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ADA_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ADA-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -10, - "id": 6, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "ADA-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"AVAXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"AVAXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"AVAX-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"AVAX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"avaxusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"AVAXUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"AVAX-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"AVAX-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -8, - "id": 7, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "AVAX-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"FILUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"FIL-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"FIL_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"filusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"FILUSD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"FIL_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"FIL-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 8, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "FIL-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"LTCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"LTCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"LTC-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"ltcusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XLTCZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"LTC-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"LTC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"LTC-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -8, - "id": 9, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "LTC-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"DOGEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"DOGEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"DOGE-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"DOGE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"dogeusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XDGUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"DOGE-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"DOGE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"DOGE-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -11, - "id": 10, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "DOGE-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ATOMUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"ATOMUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ATOM-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"ATOM_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"ATOMUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ATOM-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ATOM_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ATOM-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 11, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "ATOM-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"DOTUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"DOTUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"DOT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"DOT_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"DOTUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"DOT-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"DOT_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"DOT-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 12, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "DOT-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"UNIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"UNIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"UNI-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"UNI_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"UNIUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"UNI-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"UNI-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 13, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "UNI-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"BCHUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"BCHUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"BCH-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"BCH_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"bchusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"BCHUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"BCH-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"BCH_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"BCH-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -7, - "id": 14, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "BCH-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"TRXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"TRXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"TRX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"trxusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"TRXUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"TRX-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"TRX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"TRX-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -11, - "id": 15, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "TRX-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"NEARUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"NEAR-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"NEAR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"nearusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"NEAR-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"NEAR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"NEAR-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 16, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "NEAR-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"MKRUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"MKR-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"MKRUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"MKR-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"MKR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"MKR-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -6, - "id": 17, - "min_exchanges": 3, - "min_price_change_ppm": 4000, - "pair": "MKR-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"XLMUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"XLMUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"XLM-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XXLMZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"XLM-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"XLM_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"XLM-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -10, - "id": 18, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "XLM-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ETCUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ETC-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"ETC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"etcusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ETC-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ETC_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ETC-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -8, - "id": 19, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "ETC-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"COMPUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"COMP-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"COMP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"COMPUSD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"COMP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"COMP-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -8, - "id": 20, - "min_exchanges": 3, - "min_price_change_ppm": 4000, - "pair": "COMP-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"WLDUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"WLDUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"WLD_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"wldusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"WLD-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"WLD_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"WLD-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 21, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "WLD-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"APEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"APE-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"APE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"APEUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"APE-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"APE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"APE-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 22, - "min_exchanges": 3, - "min_price_change_ppm": 4000, - "pair": "APE-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"APTUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"APTUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"APT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"APT_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"aptusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"APT-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"APT_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"APT-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 23, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "APT-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"ARBUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"ARBUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ARB-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"ARB_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"arbusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"ARB-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"ARB_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ARB-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 24, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "ARB-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"BLUR-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"BLUR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"BLURUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"BLUR-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"BLUR_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"BLUR-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -10, - "id": 25, - "min_exchanges": 3, - "min_price_change_ppm": 4000, - "pair": "BLUR-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"LDOUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"LDO-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"LDOUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"LDO-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"LDO_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"LDO-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 26, - "min_exchanges": 3, - "min_price_change_ppm": 4000, - "pair": "LDO-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"OPUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"OP-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"OP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"OP-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"OP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"OP-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 27, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "OP-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"PEPEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"PEPEUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"PEPE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"PEPEUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"PEPE-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"PEPE_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"PEPE-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -16, - "id": 28, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "PEPE-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"SEIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"SEIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"SEI-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"SEI_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"seiusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"SEI-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"SEI_USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -10, - "id": 29, - "min_exchanges": 3, - "min_price_change_ppm": 4000, - "pair": "SEI-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"SHIBUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"SHIBUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"SHIB-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"SHIB_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"SHIBUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"SHIB-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"SHIB_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"SHIB-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -15, - "id": 30, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "SHIB-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"SUIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"SUIUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"SUI-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"SUI_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"suiusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"SUI-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"SUI_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"SUI-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -10, - "id": 31, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "SUI-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"XRPUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"XRPUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"XRP-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"XRP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"xrpusdt\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XXRPZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"XRP-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"XRP_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"XRP-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -10, - "id": 32, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "XRP-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"USDCUSDT\",\"invert\":true},{\"exchangeName\":\"Bybit\",\"ticker\":\"USDCUSDT\",\"invert\":true},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"USDT-USD\"},{\"exchangeName\":\"Huobi\",\"ticker\":\"ethusdt\",\"adjustByMarket\":\"ETH-USD\",\"invert\":true},{\"exchangeName\":\"Kraken\",\"ticker\":\"USDTZUSD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"BTC-USDT\",\"adjustByMarket\":\"BTC-USD\",\"invert\":true},{\"exchangeName\":\"Okx\",\"ticker\":\"USDC-USDT\",\"invert\":true}]}", - "exponent": -9, - "id": 1000000, - "min_exchanges": 3, - "min_price_change_ppm": 1000, - "pair": "USDT-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"DYDXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"DYDXUSDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Gate\",\"ticker\":\"DYDX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Kucoin\",\"ticker\":\"DYDX-USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Mexc\",\"ticker\":\"DYDX_USDT\",\"adjustByMarket\":\"USDT-USD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"DYDX-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}", - "exponent": -9, - "id": 1000001, - "min_exchanges": 3, - "min_price_change_ppm": 2500, - "pair": "DYDX-USD" - }, - { - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"TestVolatileExchange\",\"ticker\":\"TEST-USD\"}]}", - "exponent": -5, - "id": 33, - "min_exchanges": 1, - "min_price_change_ppm": 250, - "pair": "TEST-USD" - } - ], - "market_prices": [ - { - "exponent": -5, - "id": 0, - "price": 2868819524 - }, - { - "exponent": -6, - "id": 1, - "price": 1811985252 - }, - { - "exponent": -9, - "id": 2, - "price": 7204646989 - }, - { - "exponent": -10, - "id": 3, - "price": 6665746387 - }, - { - "exponent": -10, - "id": 4, - "price": 6029316660 - }, - { - "exponent": -8, - "id": 5, - "price": 2350695125 - }, - { - "exponent": -10, - "id": 6, - "price": 2918831290 - }, - { - "exponent": -8, - "id": 7, - "price": 1223293720 - }, - { - "exponent": -9, - "id": 8, - "price": 4050336602 - }, - { - "exponent": -8, - "id": 9, - "price": 8193604950 - }, - { - "exponent": -11, - "id": 10, - "price": 7320836895 - }, - { - "exponent": -9, - "id": 11, - "price": 8433494428 - }, - { - "exponent": -9, - "id": 12, - "price": 4937186533 - }, - { - "exponent": -9, - "id": 13, - "price": 5852293356 - }, - { - "exponent": -7, - "id": 14, - "price": 2255676327 - }, - { - "exponent": -11, - "id": 15, - "price": 7795369902 - }, - { - "exponent": -9, - "id": 16, - "price": 1312325536 - }, - { - "exponent": -6, - "id": 17, - "price": 1199517382 - }, - { - "exponent": -10, - "id": 18, - "price": 1398578933 - }, - { - "exponent": -8, - "id": 19, - "price": 1741060746 - }, - { - "exponent": -8, - "id": 20, - "price": 5717635307 - }, - { - "exponent": -9, - "id": 21, - "price": 1943019371 - }, - { - "exponent": -9, - "id": 22, - "price": 1842365656 - }, - { - "exponent": -9, - "id": 23, - "price": 6787621897 - }, - { - "exponent": -9, - "id": 24, - "price": 1127629325 - }, - { - "exponent": -10, - "id": 25, - "price": 2779565892 - }, - { - "exponent": -9, - "id": 26, - "price": 1855061997 - }, - { - "exponent": -9, - "id": 27, - "price": 1562218603 - }, - { - "exponent": -16, - "id": 28, - "price": 2481900353 - }, - { - "exponent": -10, - "id": 29, - "price": 1686998025 - }, - { - "exponent": -15, - "id": 30, - "price": 8895882688 - }, - { - "exponent": -10, - "id": 31, - "price": 5896318772 - }, - { - "exponent": -10, - "id": 32, - "price": 6327613800 - }, - { - "exponent": -9, - "id": 1000000, - "price": 1000000000 - }, - { - "exponent": -9, - "id": 1000001, - "price": 2050000000 - }, - { - "exponent": -5, - "id": 33, - "price": 10000000 - } - ] - }, - "rewards": { - "params": { + { "denom": "adv4tnt", - "denom_exponent": -18, - "fee_multiplier_ppm": 990000, - "market_id": 11, - "treasury_account": "rewards_treasury" + "end_time": "2025-01-01T00:00:00Z", + "start_time": "2023-01-01T00:00:00Z", + "treasury_account": "rewards_treasury", + "vester_account": "rewards_vester" } + ] + } + }, + "consensus": { + "params": { + "block": { + "max_bytes": "22020096", + "max_gas": "-1" }, - "sending": {}, - "slashing": { - "missed_blocks": [], - "params": { - "downtime_jail_duration": "60s", - "min_signed_per_window": "0.050000000000000000", - "signed_blocks_window": "3000", - "slash_fraction_double_sign": "0.000000000000000000", - "slash_fraction_downtime": "0.000000000000000000" - }, - "signing_infos": [] - }, - "staking": { - "delegations": [], - "exported": false, - "last_total_power": "0", - "last_validator_powers": [], - "params": { - "bond_denom": "adv4tnt", - "historical_entries": 10000, - "max_entries": 7, - "max_validators": 100, - "min_commission_rate": "0.000000000000000000", - "unbonding_time": "1814400s" - }, - "redelegations": [], - "unbonding_delegations": [], - "validators": [] - }, - "stats": { - "params": { - "window_duration": "2592000s" - } + "evidence": { + "max_age_num_blocks": "100000", + "max_age_duration": "172800000000000", + "max_bytes": "1048576" }, - "subaccounts": { - "subaccounts": [ - { - "asset_positions": [ - { - "asset_id": 0, - "index": 0, - "quantums": "100000000000000000" - } - ], - "id": { - "number": 0, - "owner": "dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4" - }, - "margin_enabled": true - }, - { - "asset_positions": [ - { - "asset_id": 0, - "index": 0, - "quantums": "100000000000000000" - } - ], - "id": { - "number": 0, - "owner": "dydx10fx7sy6ywd5senxae9dwytf8jxek3t2gcen2vs" - }, - "margin_enabled": true - }, - { - "asset_positions": [ - { - "asset_id": 0, - "index": 0, - "quantums": "100000000000000000" - } - ], - "id": { - "number": 0, - "owner": "dydx1fjg6zp6vv8t9wvy4lps03r5l4g7tkjw9wvmh70" - }, - "margin_enabled": true - }, - { - "asset_positions": [ - { - "asset_id": 0, - "index": 0, - "quantums": "100000000000000000" - } - ], - "id": { - "number": 0, - "owner": "dydx1wau5mja7j7zdavtfq9lu7ejef05hm6ffenlcsn" - }, - "margin_enabled": true - }, - { - "asset_positions": [ - { - "asset_id": 0, - "index": 0, - "quantums": "900000000000000000" - } - ], - "id": { - "number": 0, - "owner": "dydx1nzuttarf5k2j0nug5yzhr6p74t9avehn9hlh8m" - }, - "margin_enabled": true - } + "validator": { + "pub_key_types": [ + "ed25519" ] }, - "transfer": { - "denom_traces": [], - "params": { - "receive_enabled": true, - "send_enabled": true - }, - "port_id": "transfer", - "total_escrowed": [] + "version": { + "app": "0" }, - "upgrade": {}, - "vault": {}, - "vest": { - "vest_entries": [ - { - "denom": "adv4tnt", - "end_time": "2025-01-01T00:00:00Z", - "start_time": "2023-01-01T00:00:00Z", - "treasury_account": "community_treasury", - "vester_account": "community_vester" - }, - { - "denom": "adv4tnt", - "end_time": "2025-01-01T00:00:00Z", - "start_time": "2023-01-01T00:00:00Z", - "treasury_account": "rewards_treasury", - "vester_account": "rewards_vester" - } - ] + "abci": { + "vote_extensions_enable_height": "0" } } } +} \ No newline at end of file diff --git a/protocol/testing/containertest/testnet.go b/protocol/testing/containertest/testnet.go index 660ef58224..8e036476c3 100644 --- a/protocol/testing/containertest/testnet.go +++ b/protocol/testing/containertest/testnet.go @@ -25,7 +25,7 @@ const persistentPeers = "17e5e45691f0d01449c84fd4ae87279578cdd7ec@testnet-local- const resourceLifetimeSecs = 600 // The version of that we're upgrading to (aka the current commit) -const UpgradeToVersion = "v4.0.0" +const UpgradeToVersion = "v5.0.0" func monikers() map[string]string { return map[string]string{ diff --git a/protocol/testing/genesis.sh b/protocol/testing/genesis.sh index 452ad0ae0e..2c9b065f98 100755 --- a/protocol/testing/genesis.sh +++ b/protocol/testing/genesis.sh @@ -125,6 +125,7 @@ function edit_genesis() { # Update perpetuals module. # Liquidity Tiers. + # TODO(OTE-208): Finalize default values for open interest caps. dasel put -t json -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers' -v "[]" # Liquidity Tier: Large-Cap dasel put -t json -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[]' -v "{}" @@ -134,6 +135,8 @@ function edit_genesis() { dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[0].maintenance_fraction_ppm' -v '600000' # 60% of IM dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[0].base_position_notional' -v '1000000000000' # 1_000_000 USDC dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[0].impact_notional' -v '10000000000' # 10_000 USDC (500 USDC / 5%) + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[0].open_interest_lower_cap' -v '0' # OIMF doesn't apply to Large-Cap + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[0].open_interest_upper_cap' -v '0' # OIMF doesn't apply to Large-Cap # Liquidity Tier: Mid-Cap dasel put -t json -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[]' -v "{}" @@ -143,6 +146,8 @@ function edit_genesis() { dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[1].maintenance_fraction_ppm' -v '500000' # 50% of IM dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[1].base_position_notional' -v '250000000000' # 250_000 USDC dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[1].impact_notional' -v '5000000000' # 5_000 USDC (500 USDC / 10%) + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[1].open_interest_lower_cap' -v '25000000000000' # 25 million USDC + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[1].open_interest_upper_cap' -v '50000000000000' # 50 million USDC # Liquidity Tier: Long-Tail dasel put -t json -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[]' -v "{}" @@ -152,6 +157,8 @@ function edit_genesis() { dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[2].maintenance_fraction_ppm' -v '500000' # 50% of IM dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[2].base_position_notional' -v '100000000000' # 100_000 USDC dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[2].impact_notional' -v '2500000000' # 2_500 USDC (500 USDC / 20%) + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[2].open_interest_lower_cap' -v '10000000000000' # 10 million USDC + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[2].open_interest_upper_cap' -v '20000000000000' # 20 million USDC # Liquidity Tier: Safety dasel put -t json -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[]' -v "{}" @@ -161,6 +168,10 @@ function edit_genesis() { dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[3].maintenance_fraction_ppm' -v '200000' # 20% of IM dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[3].base_position_notional' -v '1000000000' # 1_000 USDC dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[3].impact_notional' -v '2500000000' # 2_500 USDC (2_500 USDC / 100%) + # OIMF doesn't apply to `Safety`, since IMF is already at 100%. + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[3].open_interest_lower_cap' -v '0' + dasel put -t int -f "$GENESIS" '.app_state.perpetuals.liquidity_tiers.[3].open_interest_upper_cap' -v '0' + # Params. dasel put -t int -f "$GENESIS" '.app_state.perpetuals.params.funding_rate_clamp_factor_ppm' -v '6000000' # 600 % (same as 75% on hourly rate) diff --git a/protocol/testutil/constants/perpetuals.go b/protocol/testutil/constants/perpetuals.go index 3e55df8e80..2069fe0e65 100644 --- a/protocol/testutil/constants/perpetuals.go +++ b/protocol/testutil/constants/perpetuals.go @@ -118,6 +118,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_0DefaultFunding_0AtomicResolution = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -130,6 +131,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_NegativeDefaultFunding_10AtomicResolution = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -142,6 +144,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_0DefaultFunding_10AtomicResolution = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -154,6 +157,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_0DefaultFunding_10AtomicResolution_20IM_18MM = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -166,6 +170,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_0_001Percent_DefaultFunding_10AtomicResolution = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -178,6 +183,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_SmallMarginRequirement = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -190,6 +196,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_100PercentMarginRequirement = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -202,6 +209,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_50PercentInitial_40PercentMaintenance = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -214,6 +222,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_20PercentInitial_10PercentMaintenance = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -226,6 +235,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } BtcUsd_NoMarginRequirement = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -238,6 +248,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } EthUsd_0DefaultFunding_9AtomicResolution = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -250,6 +261,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } EthUsd_NoMarginRequirement = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -262,6 +274,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } EthUsd_20PercentInitial_10PercentMaintenance = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -274,6 +287,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } EthUsd_100PercentMarginRequirement = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -286,6 +300,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } SolUsd_20PercentInitial_10PercentMaintenance = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -298,6 +313,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } IsoUsd_IsolatedMarket = perptypes.Perpetual{ Params: perptypes.PerpetualParams{ @@ -391,6 +407,8 @@ var ( InitialMarginPpm: 200_000, MaintenanceFractionPpm: 500_000, ImpactNotional: 2_500_000_000, + OpenInterestLowerCap: 0, + OpenInterestUpperCap: 0, }, { Id: uint32(1), @@ -398,6 +416,8 @@ var ( InitialMarginPpm: 300_000, MaintenanceFractionPpm: 600_000, ImpactNotional: 1_667_000_000, + OpenInterestLowerCap: 25_000_000_000_000, + OpenInterestUpperCap: 50_000_000_000_000, }, { Id: uint32(2), @@ -405,6 +425,8 @@ var ( InitialMarginPpm: 400_000, MaintenanceFractionPpm: 700_000, ImpactNotional: 1_250_000_000, + OpenInterestLowerCap: 10_000_000_000_000, + OpenInterestUpperCap: 20_000_000_000_000, }, }, Params: PerpetualsGenesisParams, @@ -417,6 +439,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), }, { Params: perptypes.PerpetualParams{ @@ -426,6 +449,7 @@ var ( MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), }, }, } diff --git a/protocol/testutil/constants/positions.go b/protocol/testutil/constants/positions.go index 1489bb4770..125af3e227 100644 --- a/protocol/testutil/constants/positions.go +++ b/protocol/testutil/constants/positions.go @@ -73,6 +73,13 @@ var ( PerpetualId: 1, Quantums: dtypes.NewIntFromBigInt(BigNegMaxUint64()), // 18,446,744,070 ETH, -$55,340,232,210,000 notional. } + // Long position for arbitrary isolated market + PerpetualPosition_OneISOLong = satypes.PerpetualPosition{ + PerpetualId: 3, + Quantums: dtypes.NewInt(100_000_000), + FundingIndex: dtypes.NewInt(0), + } + // Asset Positions Usdc_Asset_0 = satypes.AssetPosition{ AssetId: 0, diff --git a/protocol/testutil/keeper/perpetuals.go b/protocol/testutil/keeper/perpetuals.go index 622ffc25d2..851926a66d 100644 --- a/protocol/testutil/keeper/perpetuals.go +++ b/protocol/testutil/keeper/perpetuals.go @@ -192,6 +192,8 @@ func CreateTestLiquidityTiers(t *testing.T, ctx sdk.Context, k *keeper.Keeper) { l.InitialMarginPpm, l.MaintenanceFractionPpm, l.ImpactNotional, + l.OpenInterestLowerCap, + l.OpenInterestUpperCap, ) require.NoError(t, err) diff --git a/protocol/testutil/perpetuals/perpetuals.go b/protocol/testutil/perpetuals/perpetuals.go index 451da22b7b..dbcce92229 100644 --- a/protocol/testutil/perpetuals/perpetuals.go +++ b/protocol/testutil/perpetuals/perpetuals.go @@ -67,6 +67,7 @@ func GeneratePerpetual(optionalModifications ...PerpetualModifierOption) *perpty MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } for _, opt := range optionalModifications { diff --git a/protocol/x/clob/abci.go b/protocol/x/clob/abci.go index bc26300040..a2201e3035 100644 --- a/protocol/x/clob/abci.go +++ b/protocol/x/clob/abci.go @@ -245,6 +245,9 @@ func PrepareCheckState( types.GetInternalOperationsQueueTextString(newLocalValidatorOperationsQueue), ) + // Initialize new GRPC streams with orderbook snapshots, if any. + keeper.InitializeNewGrpcStreams(ctx) + // Set per-orderbook gauges. keeper.MemClob.SetMemclobGauges(ctx) } diff --git a/protocol/x/clob/abci_test.go b/protocol/x/clob/abci_test.go index 7af637abc2..44d2d9af36 100644 --- a/protocol/x/clob/abci_test.go +++ b/protocol/x/clob/abci_test.go @@ -1338,7 +1338,7 @@ func TestPrepareCheckState(t *testing.T) { constants.Usdc.Denom, ).Return(sdk.NewCoin(constants.Usdc.Denom, sdkmath.NewIntFromBigInt(new(big.Int)))) mockBankKeeper.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, mock.Anything, mock.Anything, diff --git a/protocol/x/clob/keeper/keeper.go b/protocol/x/clob/keeper/keeper.go index 13af8452b5..370ef8d3ac 100644 --- a/protocol/x/clob/keeper/keeper.go +++ b/protocol/x/clob/keeper/keeper.go @@ -219,3 +219,22 @@ func (k Keeper) InitMemStore(ctx sdk.Context) { func (k *Keeper) SetAnteHandler(anteHandler sdk.AnteHandler) { k.antehandler = anteHandler } + +// InitializeNewGrpcStreams initializes new gRPC streams for all uninitialized clob pairs +// by sending the corresponding orderbook snapshots. +func (k Keeper) InitializeNewGrpcStreams(ctx sdk.Context) { + streamingManager := k.GetGrpcStreamingManager() + allUpdates := types.NewOffchainUpdates() + + uninitializedClobPairIds := streamingManager.GetUninitializedClobPairIds() + for _, clobPairId := range uninitializedClobPairIds { + update := k.MemClob.GetOffchainUpdatesForOrderbookSnapshot( + ctx, + types.ClobPairId(clobPairId), + ) + + allUpdates.Append(update) + } + + streamingManager.SendOrderbookUpdates(allUpdates, true) +} diff --git a/protocol/x/clob/keeper/liquidations_test.go b/protocol/x/clob/keeper/liquidations_test.go index a69a7c817d..ec916312e1 100644 --- a/protocol/x/clob/keeper/liquidations_test.go +++ b/protocol/x/clob/keeper/liquidations_test.go @@ -235,25 +235,25 @@ func TestPlacePerpetualLiquidation(t *testing.T) { memClob := memclob.NewMemClobPriceTimePriority(false) mockBankKeeper := &mocks.BankKeeper{} mockBankKeeper.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.Anything, ).Return(nil) mockBankKeeper.On( "SendCoins", mock.Anything, authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + perptypes.InsuranceFundModuleAddress, mock.Anything, ).Return(nil) // Fee collector does not have any funds. mockBankKeeper.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - authtypes.FeeCollectorName, - satypes.ModuleName, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), + satypes.ModuleAddress, mock.Anything, ).Return(sdkerrors.ErrInsufficientFunds) // Give the insurance fund a 1M USDC balance. @@ -793,6 +793,13 @@ func TestPlacePerpetualLiquidation_PreexistingLiquidation(t *testing.T) { mock.Anything, mock.Anything, ).Return(nil) + bk.On( + "SendCoins", + mock.Anything, + mock.Anything, + mock.Anything, + mock.Anything, + ).Return(nil) bk.On( "GetBalance", mock.Anything, @@ -833,6 +840,13 @@ func TestPlacePerpetualLiquidation_PreexistingLiquidation(t *testing.T) { mock.Anything, mock.Anything, ).Return(nil) + bk.On( + "SendCoins", + mock.Anything, + mock.Anything, + mock.Anything, + mock.Anything, + ).Return(nil) bk.On( "GetBalance", mock.Anything, diff --git a/protocol/x/clob/keeper/mev_test.go b/protocol/x/clob/keeper/mev_test.go index 9c12550d27..6f0cd44d16 100644 --- a/protocol/x/clob/keeper/mev_test.go +++ b/protocol/x/clob/keeper/mev_test.go @@ -1244,6 +1244,13 @@ func TestGetMidPrices(t *testing.T) { mock.Anything, mock.Anything, ).Return(nil) + mockBankKeeper.On( + "SendCoins", + mock.Anything, + mock.Anything, + mock.Anything, + mock.Anything, + ).Return(nil) ks := keepertest.NewClobKeepersTestContext(t, memclob, mockBankKeeper, indexer_manager.NewIndexerEventManagerNoop()) ctx := ks.Ctx.WithIsCheckTx(true) diff --git a/protocol/x/clob/keeper/orders.go b/protocol/x/clob/keeper/orders.go index 4df957e2db..db709c469d 100644 --- a/protocol/x/clob/keeper/orders.go +++ b/protocol/x/clob/keeper/orders.go @@ -1312,7 +1312,7 @@ func (k Keeper) SendOffchainMessages( k.GetIndexerEventManager().SendOffchainData(update) } - k.GetGrpcStreamingManager().SendOrderbookUpdates(offchainUpdates) + k.GetGrpcStreamingManager().SendOrderbookUpdates(offchainUpdates, false) } // getFillQuoteQuantums returns the total fillAmount price in quote quantums based on the maker subticks. diff --git a/protocol/x/clob/keeper/orders_test.go b/protocol/x/clob/keeper/orders_test.go index 79998ab3fe..3bf0795743 100644 --- a/protocol/x/clob/keeper/orders_test.go +++ b/protocol/x/clob/keeper/orders_test.go @@ -647,7 +647,7 @@ func TestPlaceShortTermOrder(t *testing.T) { memClob := memclob.NewMemClobPriceTimePriority(false) mockBankKeeper := &mocks.BankKeeper{} mockBankKeeper.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, mock.Anything, mock.Anything, @@ -875,7 +875,7 @@ func TestAddPreexistingStatefulOrder(t *testing.T) { memClob := memclob.NewMemClobPriceTimePriority(false) mockBankKeeper := &mocks.BankKeeper{} mockBankKeeper.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, mock.Anything, mock.Anything, diff --git a/protocol/x/clob/keeper/process_operations_liquidations_test.go b/protocol/x/clob/keeper/process_operations_liquidations_test.go index ef86f581f1..b73dac4170 100644 --- a/protocol/x/clob/keeper/process_operations_liquidations_test.go +++ b/protocol/x/clob/keeper/process_operations_liquidations_test.go @@ -193,17 +193,17 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(10_000_000)), ).Return(nil) bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + satypes.ModuleAddress, + perptypes.InsuranceFundModuleAddress, // Subaccount pays $250 to insurance fund for liquidating 1 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(250_000_000)), ).Return(nil).Once() @@ -271,10 +271,10 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(10_100_000)), ).Return(nil) bk.On( @@ -286,8 +286,8 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(perptypes.InsuranceFundName), - authtypes.NewModuleAddress(satypes.ModuleName), + perptypes.InsuranceFundModuleAddress, + satypes.ModuleAddress, // Insurance fund covers $1 loss for liquidating 1 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(1_000_000)), ).Return(nil).Once() @@ -357,17 +357,17 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(2_500_000)), ).Return(nil) bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + satypes.ModuleAddress, + perptypes.InsuranceFundModuleAddress, // Subaccount pays $62.5 to insurance fund for liquidating 0.25 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(62_500_000)), ).Return(nil).Twice() @@ -455,10 +455,10 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(2_525_000)), ).Return(nil) bk.On( @@ -470,8 +470,8 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(perptypes.InsuranceFundName), - authtypes.NewModuleAddress(satypes.ModuleName), + perptypes.InsuranceFundModuleAddress, + satypes.ModuleAddress, // Insurance fund covers $0.25 loss for liquidating 0.25 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(250_000)), ).Return(nil).Twice() @@ -560,10 +560,10 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.Anything, ).Return(nil) bk.On( @@ -575,16 +575,16 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + satypes.ModuleAddress, + perptypes.InsuranceFundModuleAddress, // Pays insurance fund $0.75 for liquidating 0.75 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(750_000)), ).Return(nil).Once() bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(perptypes.InsuranceFundName), - authtypes.NewModuleAddress(satypes.ModuleName), + perptypes.InsuranceFundModuleAddress, + satypes.ModuleAddress, // Insurance fund covers $0.25 loss for liquidating 0.25 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(250_000)), ).Return(nil).Once() @@ -664,10 +664,10 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.Anything, ).Return(nil) bk.On( @@ -679,8 +679,8 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + satypes.ModuleAddress, + perptypes.InsuranceFundModuleAddress, // Pays insurance fund $0.378735 (capped by MaxLiquidationFeePpm) // for liquidating 0.75 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(378_735)), @@ -688,8 +688,8 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + satypes.ModuleAddress, + perptypes.InsuranceFundModuleAddress, // Pays insurance fund $0.121265. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(121_265)), ).Return(nil).Once() @@ -777,17 +777,17 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(5_000_000)), ).Return(nil) bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + satypes.ModuleAddress, + perptypes.InsuranceFundModuleAddress, // Subaccount pays $125 to insurance fund for liquidating 0.5 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(125_000_000)), ).Return(nil).Once() @@ -890,17 +890,17 @@ func TestProcessProposerMatches_Liquidation_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(1)), ).Return(nil) bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + satypes.ModuleAddress, + perptypes.InsuranceFundModuleAddress, mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(25)), ).Return(nil) }, @@ -1263,17 +1263,17 @@ func TestProcessProposerMatches_Liquidation_Failure(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, mock.Anything, - authtypes.FeeCollectorName, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.Anything, ).Return(fmt.Errorf("transfer failed")) bk.On( "SendCoins", mock.Anything, mock.Anything, - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + perptypes.InsuranceFundModuleAddress, mock.Anything, ).Return(nil) }, diff --git a/protocol/x/clob/keeper/process_operations_long_term_test.go b/protocol/x/clob/keeper/process_operations_long_term_test.go index 13f1f8de11..f2ecafc3a5 100644 --- a/protocol/x/clob/keeper/process_operations_long_term_test.go +++ b/protocol/x/clob/keeper/process_operations_long_term_test.go @@ -37,10 +37,10 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 25_000_000+10_000_000, @@ -106,10 +106,10 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 25_000_000+10_000_000, @@ -186,10 +186,10 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 25_000_000+10_000_000, @@ -259,10 +259,10 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 25_000_000+10_000_000, @@ -333,10 +333,10 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 25_000_000+10_000_000, @@ -406,10 +406,10 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 12_500_000+5_000_000, @@ -484,10 +484,10 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 12_500_000+5_000_000, @@ -571,17 +571,17 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(10_000_000)), ).Return(nil) bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + satypes.ModuleAddress, + perptypes.InsuranceFundModuleAddress, // Subaccount pays $250 to insurance fund for liquidating 1 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(250_000_000)), ).Return(nil).Once() @@ -659,17 +659,17 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(10_000_000)), ).Return(nil) bk.On( "SendCoins", mock.Anything, - authtypes.NewModuleAddress(satypes.ModuleName), - authtypes.NewModuleAddress(perptypes.InsuranceFundName), + satypes.ModuleAddress, + perptypes.InsuranceFundModuleAddress, // Subaccount pays $250 to insurance fund for liquidating 1 BTC. mock.MatchedBy(testutil_bank.MatchUsdcOfAmount(250_000_000)), ).Return(nil).Once() @@ -747,10 +747,10 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 12_500_000+5_000_000, @@ -838,10 +838,10 @@ func TestProcessProposerMatches_LongTerm_Success(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 12_500_000+5_000_000, diff --git a/protocol/x/clob/keeper/process_operations_stateful_validation_test.go b/protocol/x/clob/keeper/process_operations_stateful_validation_test.go index 3dfff5254c..f944523dc0 100644 --- a/protocol/x/clob/keeper/process_operations_stateful_validation_test.go +++ b/protocol/x/clob/keeper/process_operations_stateful_validation_test.go @@ -339,10 +339,10 @@ func TestProcessProposerMatches_LongTerm_StatefulValidation_Failure(t *testing.T }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 12_500_000+5_000_000, @@ -635,10 +635,10 @@ func TestProcessProposerMatches_Conditional_Validation_Failure(t *testing.T) { }, setupMockBankKeeper: func(bk *mocks.BankKeeper) { bk.On( - "SendCoinsFromModuleToModule", + "SendCoins", mock.Anything, - satypes.ModuleName, - authtypes.FeeCollectorName, + satypes.ModuleAddress, + authtypes.NewModuleAddress(authtypes.FeeCollectorName), mock.MatchedBy( testutil_bank.MatchUsdcOfAmount( 12_500_000+5_000_000, diff --git a/protocol/x/clob/keeper/process_single_match.go b/protocol/x/clob/keeper/process_single_match.go index 189465d3a5..7410bdd140 100644 --- a/protocol/x/clob/keeper/process_single_match.go +++ b/protocol/x/clob/keeper/process_single_match.go @@ -442,6 +442,7 @@ func (k Keeper) persistMatchedOrders( ctx, assettypes.AssetUsdc.Id, bigTotalFeeQuoteQuantums, + perpetualId, ); err != nil { return takerUpdateResult, makerUpdateResult, errorsmod.Wrapf( types.ErrSubaccountFeeTransferFailed, diff --git a/protocol/x/clob/memclob/memclob_grpc_streaming.go b/protocol/x/clob/memclob/memclob_grpc_streaming.go new file mode 100644 index 0000000000..a1c86d4d0c --- /dev/null +++ b/protocol/x/clob/memclob/memclob_grpc_streaming.go @@ -0,0 +1,88 @@ +package memclob + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dydxprotocol/v4-chain/protocol/indexer/off_chain_updates" + "github.com/dydxprotocol/v4-chain/protocol/lib" + "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" +) + +// GetOffchainUpdatesForOrderbookSnapshot returns the offchain updates for the orderbook snapshot. +// This is used by the gRPC streaming server to send the orderbook snapshot to the client. +func (m *MemClobPriceTimePriority) GetOffchainUpdatesForOrderbookSnapshot( + ctx sdk.Context, + clobPairId types.ClobPairId, +) (offchainUpdates *types.OffchainUpdates) { + offchainUpdates = types.NewOffchainUpdates() + + if orderbook, exists := m.openOrders.orderbooksMap[clobPairId]; exists { + // Generate the offchain updates for buy orders. + // Updates are sorted in descending order of price. + buyPriceLevels := lib.GetSortedKeys[lib.Sortable[types.Subticks]](orderbook.Bids) + for i := len(buyPriceLevels) - 1; i >= 0; i-- { + subticks := buyPriceLevels[i] + level := orderbook.Bids[subticks] + + // For each price level, generate offchain updates for each order in the level. + level.LevelOrders.Front.Each( + func(order types.ClobOrder) { + offchainUpdates.Append( + m.GetOffchainUpdatesForOrder(ctx, order.Order), + ) + }, + ) + } + + // Generate the offchain updates for sell orders. + // Updates are sorted in ascending order of price. + sellPriceLevels := lib.GetSortedKeys[lib.Sortable[types.Subticks]](orderbook.Asks) + for i := 0; i < len(sellPriceLevels); i++ { + subticks := sellPriceLevels[i] + level := orderbook.Asks[subticks] + + // For each price level, generate offchain updates for each order in the level. + level.LevelOrders.Front.Each( + func(order types.ClobOrder) { + offchainUpdates.Append( + m.GetOffchainUpdatesForOrder(ctx, order.Order), + ) + }, + ) + } + } + + return offchainUpdates +} + +// GetOffchainUpdatesForOrder returns a place order offchain message and +// a update order offchain message used to construct an order for +// the orderbook snapshot grpc stream. +func (m *MemClobPriceTimePriority) GetOffchainUpdatesForOrder( + ctx sdk.Context, + order types.Order, +) (offchainUpdates *types.OffchainUpdates) { + offchainUpdates = types.NewOffchainUpdates() + orderId := order.OrderId + + // Generate a order place message. + if message, success := off_chain_updates.CreateOrderPlaceMessage( + ctx, + order, + ); success { + offchainUpdates.AddPlaceMessage(orderId, message) + } + + // Get the current fill amount of the order. + fillAmount := m.GetOrderFilledAmount(ctx, orderId) + + // Generate an update message updating the total filled amount of order. + if message, success := off_chain_updates.CreateOrderUpdateMessage( + ctx, + orderId, + fillAmount, + ); success { + offchainUpdates.AddUpdateMessage(orderId, message) + } + + return offchainUpdates +} diff --git a/protocol/x/clob/memclob/memclob_grpc_streaming_test.go b/protocol/x/clob/memclob/memclob_grpc_streaming_test.go new file mode 100644 index 0000000000..e5bd2bf3f2 --- /dev/null +++ b/protocol/x/clob/memclob/memclob_grpc_streaming_test.go @@ -0,0 +1,91 @@ +package memclob + +import ( + "testing" + + "github.com/dydxprotocol/v4-chain/protocol/mocks" + "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" + sdktest "github.com/dydxprotocol/v4-chain/protocol/testutil/sdk" + "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" +) + +func TestGetOffchainUpdatesForOrderbookSnapshot_Buy(t *testing.T) { + ctx, _, _ := sdktest.NewSdkContextWithMultistore() + + clobKeeper := &mocks.MemClobKeeper{} + clobKeeper.On( + "GetOrderFillAmount", + mock.Anything, + mock.Anything, + ).Return(false, satypes.BaseQuantums(0), uint32(0)) + + memclob := NewMemClobPriceTimePriority(false) + memclob.SetClobKeeper(clobKeeper) + + memclob.CreateOrderbook(ctx, constants.ClobPair_Btc) + + orders := []types.Order{ + constants.Order_Alice_Num0_Id1_Clob0_Buy15_Price10_GTB18_PO, + constants.Order_Alice_Num0_Id0_Clob0_Buy10_Price10_GTB16, + constants.Order_Bob_Num0_Id12_Clob0_Buy5_Price40_GTB20, + } + + for _, order := range orders { + memclob.mustAddOrderToOrderbook(ctx, order, false) + } + + offchainUpdates := memclob.GetOffchainUpdatesForOrderbookSnapshot( + ctx, + constants.ClobPair_Btc.GetClobPairId(), + ) + + expected := types.NewOffchainUpdates() + // Buy orders are in descending order. + expected.Append(memclob.GetOffchainUpdatesForOrder(ctx, orders[2])) + expected.Append(memclob.GetOffchainUpdatesForOrder(ctx, orders[0])) + expected.Append(memclob.GetOffchainUpdatesForOrder(ctx, orders[1])) + + require.Equal(t, expected, offchainUpdates) +} + +func TestGetOffchainUpdatesForOrderbookSnapshot_Sell(t *testing.T) { + ctx, _, _ := sdktest.NewSdkContextWithMultistore() + + clobKeeper := &mocks.MemClobKeeper{} + clobKeeper.On( + "GetOrderFillAmount", + mock.Anything, + mock.Anything, + ).Return(false, satypes.BaseQuantums(0), uint32(0)) + + memclob := NewMemClobPriceTimePriority(false) + memclob.SetClobKeeper(clobKeeper) + + memclob.CreateOrderbook(ctx, constants.ClobPair_Btc) + + orders := []types.Order{ + constants.Order_Bob_Num0_Id12_Clob0_Sell20_Price35_GTB32, + constants.Order_Alice_Num0_Id0_Clob0_Sell5_Price10_GTB20, + constants.Order_Alice_Num0_Id1_Clob0_Sell15_Price10_GTB18_PO, + } + + for _, order := range orders { + memclob.mustAddOrderToOrderbook(ctx, order, false) + } + + offchainUpdates := memclob.GetOffchainUpdatesForOrderbookSnapshot( + ctx, + constants.ClobPair_Btc.GetClobPairId(), + ) + + expected := types.NewOffchainUpdates() + // Sell orders are in ascending order. + expected.Append(memclob.GetOffchainUpdatesForOrder(ctx, orders[1])) + expected.Append(memclob.GetOffchainUpdatesForOrder(ctx, orders[2])) + expected.Append(memclob.GetOffchainUpdatesForOrder(ctx, orders[0])) + + require.Equal(t, expected, offchainUpdates) +} diff --git a/protocol/x/clob/types/clob_keeper.go b/protocol/x/clob/types/clob_keeper.go index 02b64e7c25..795b3d3f61 100644 --- a/protocol/x/clob/types/clob_keeper.go +++ b/protocol/x/clob/types/clob_keeper.go @@ -131,4 +131,5 @@ type ClobKeeper interface { clobPair ClobPair, ) error UpdateLiquidationsConfig(ctx sdk.Context, config LiquidationsConfig) error + InitializeNewGrpcStreams(ctx sdk.Context) } diff --git a/protocol/x/clob/types/expected_keepers.go b/protocol/x/clob/types/expected_keepers.go index 81b4aef392..3c4c8b86a2 100644 --- a/protocol/x/clob/types/expected_keepers.go +++ b/protocol/x/clob/types/expected_keepers.go @@ -63,11 +63,7 @@ type SubaccountsKeeper interface { ctx sdk.Context, blockHeight uint32, ) - TransferFeesToFeeCollectorModule( - ctx sdk.Context, - assetId uint32, - amount *big.Int, - ) error + TransferFeesToFeeCollectorModule(ctx sdk.Context, assetId uint32, amount *big.Int, perpetualId uint32) error TransferInsuranceFundPayments( ctx sdk.Context, amount *big.Int, diff --git a/protocol/x/clob/types/memclob.go b/protocol/x/clob/types/memclob.go index d80d5b1345..feb4ab6f49 100644 --- a/protocol/x/clob/types/memclob.go +++ b/protocol/x/clob/types/memclob.go @@ -133,4 +133,8 @@ type MemClob interface { subaccountId satypes.SubaccountId, perpetualId uint32, ) + GetOffchainUpdatesForOrderbookSnapshot( + ctx sdk.Context, + clobPairId ClobPairId, + ) (offchainUpdates *OffchainUpdates) } diff --git a/protocol/x/perpetuals/client/cli/query_perpetual_test.go b/protocol/x/perpetuals/client/cli/query_perpetual_test.go index 09d532dce2..a09224f2db 100644 --- a/protocol/x/perpetuals/client/cli/query_perpetual_test.go +++ b/protocol/x/perpetuals/client/cli/query_perpetual_test.go @@ -24,6 +24,19 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" ) +var ( + serializableIntCmpOpts = cmp.Options{ + cmpopts.IgnoreFields(types.Perpetual{}, "FundingIndex"), // existing ignore option + cmp.FilterValues( + func(x, y dtypes.SerializableInt) bool { + // This will apply the custom comparer only to SerializableInt fields + return true // Apply this filter to all SerializableInt values + }, + cmp.Comparer(func(x, y dtypes.SerializableInt) bool { return x.Cmp(y) == 0 }), + ), + } +) + func networkWithLiquidityTierAndPerpetualObjects( t *testing.T, m int, @@ -75,6 +88,7 @@ func networkWithLiquidityTierAndPerpetualObjects( MarketType: marketType, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } nullify.Fill(&perpetual) //nolint:staticcheck state.Perpetuals = append(state.Perpetuals, perpetual) @@ -142,7 +156,7 @@ func TestShowPerpetual(t *testing.T) { // FundingIndex field is ignored since it can vary depending on funding-tick epoch. // TODO(DEC-606): Improve end-to-end testing related to ticking epochs. func checkExpectedPerp(t *testing.T, expected types.Perpetual, received types.Perpetual) { - if diff := cmp.Diff(expected, received, cmpopts.IgnoreFields(types.Perpetual{}, "FundingIndex")); diff != "" { + if diff := cmp.Diff(expected, received, serializableIntCmpOpts...); diff != "" { t.Errorf("resp.Perpetual mismatch (-want +received):\n%s", diff) } } @@ -215,12 +229,13 @@ func TestListPerpetual(t *testing.T) { require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NoError(t, err) require.Equal(t, len(objs), int(resp.Pagination.Total)) - cmpOptions := []cmp.Option{ - cmpopts.IgnoreFields(types.Perpetual{}, "FundingIndex"), + cmpOptions := append( + serializableIntCmpOpts, cmpopts.SortSlices(func(x, y types.Perpetual) bool { return x.Params.Id > y.Params.Id }), - } + ) + if diff := cmp.Diff(objs, resp.Perpetual, cmpOptions...); diff != "" { t.Errorf("resp.Perpetual mismatch (-want +received):\n%s", diff) } diff --git a/protocol/x/perpetuals/genesis.go b/protocol/x/perpetuals/genesis.go index fc9e4c9ab6..db9650d916 100644 --- a/protocol/x/perpetuals/genesis.go +++ b/protocol/x/perpetuals/genesis.go @@ -26,6 +26,8 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) elem.InitialMarginPpm, elem.MaintenanceFractionPpm, elem.ImpactNotional, + elem.OpenInterestLowerCap, + elem.OpenInterestUpperCap, ) if err != nil { diff --git a/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier.go b/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier.go index e2be739d82..a2e6e75f89 100644 --- a/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier.go +++ b/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier.go @@ -30,6 +30,8 @@ func (k msgServer) SetLiquidityTier( msg.LiquidityTier.InitialMarginPpm, msg.LiquidityTier.MaintenanceFractionPpm, msg.LiquidityTier.ImpactNotional, + msg.LiquidityTier.OpenInterestLowerCap, + msg.LiquidityTier.OpenInterestUpperCap, ); err != nil { return nil, err } diff --git a/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier_test.go b/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier_test.go index 111aff9d7a..cf60802833 100644 --- a/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier_test.go +++ b/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier_test.go @@ -114,6 +114,21 @@ func TestSetLiquidityTier(t *testing.T) { }, expectedErr: "invalid authority", }, + "Failure: invalid open interest caps": { + msg: &types.MsgSetLiquidityTier{ + Authority: lib.GovModuleAddress.String(), + LiquidityTier: types.LiquidityTier{ + Id: testLt.Id, + Name: "medium-cap", + InitialMarginPpm: 567_123, + MaintenanceFractionPpm: 500_001, + ImpactNotional: 1_300_303, + OpenInterestLowerCap: 100, + OpenInterestUpperCap: 50, + }, + }, + expectedErr: "open interest lower cap is larger than upper cap", + }, } for name, tc := range tests { @@ -126,6 +141,8 @@ func TestSetLiquidityTier(t *testing.T) { testLt.InitialMarginPpm, testLt.MaintenanceFractionPpm, testLt.ImpactNotional, + testLt.OpenInterestLowerCap, + testLt.OpenInterestUpperCap, ) require.NoError(t, err) diff --git a/protocol/x/perpetuals/keeper/perpetual.go b/protocol/x/perpetuals/keeper/perpetual.go index cdeb64e590..dc0f0e9b31 100644 --- a/protocol/x/perpetuals/keeper/perpetual.go +++ b/protocol/x/perpetuals/keeper/perpetual.go @@ -100,6 +100,7 @@ func (k Keeper) CreatePerpetual( MarketType: marketType, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } if err := k.validatePerpetual( @@ -1434,6 +1435,8 @@ func (k Keeper) SetLiquidityTier( initialMarginPpm uint32, maintenanceFractionPpm uint32, impactNotional uint64, + openInterestLowerCap uint64, + openInterestUpperCap uint64, ) ( liquidityTier types.LiquidityTier, err error, @@ -1445,6 +1448,8 @@ func (k Keeper) SetLiquidityTier( InitialMarginPpm: initialMarginPpm, MaintenanceFractionPpm: maintenanceFractionPpm, ImpactNotional: impactNotional, + OpenInterestLowerCap: openInterestLowerCap, + OpenInterestUpperCap: openInterestUpperCap, } // Validate liquidity tier's fields. diff --git a/protocol/x/perpetuals/keeper/perpetual_test.go b/protocol/x/perpetuals/keeper/perpetual_test.go index 95e569892e..fbae544a07 100644 --- a/protocol/x/perpetuals/keeper/perpetual_test.go +++ b/protocol/x/perpetuals/keeper/perpetual_test.go @@ -685,6 +685,8 @@ func TestGetMarginRequirements_Success(t *testing.T) { tc.initialMarginPpm, tc.maintenanceFractionPpm, 1, // dummy impact notional value + 0, // dummy open interest lower cap + 0, // dummy open interest upper cap ) require.NoError(t, err) @@ -2825,6 +2827,8 @@ func TestGetAllLiquidityTiers_Sorted(t *testing.T) { lt.InitialMarginPpm, lt.MaintenanceFractionPpm, lt.ImpactNotional, + lt.OpenInterestLowerCap, + lt.OpenInterestUpperCap, ) require.NoError(t, err) } @@ -2863,6 +2867,8 @@ func TestHasLiquidityTier(t *testing.T) { lt.InitialMarginPpm, lt.MaintenanceFractionPpm, lt.ImpactNotional, + lt.OpenInterestLowerCap, + lt.OpenInterestUpperCap, ) require.NoError(t, err) } @@ -2887,6 +2893,8 @@ func TestCreateLiquidityTier_Success(t *testing.T) { lt.InitialMarginPpm, lt.MaintenanceFractionPpm, lt.ImpactNotional, + lt.OpenInterestLowerCap, + lt.OpenInterestUpperCap, ) require.NoError(t, err) @@ -2911,6 +2919,8 @@ func TestSetLiquidityTier_New_Failure(t *testing.T) { initialMarginPpm uint32 maintenanceFractionPpm uint32 impactNotional uint64 + openInterestLowerCap uint64 + openInterestUpperCap uint64 expectedError error }{ "Initial Margin Ppm exceeds maximum": { @@ -2919,6 +2929,8 @@ func TestSetLiquidityTier_New_Failure(t *testing.T) { initialMarginPpm: lib.OneMillion + 1, maintenanceFractionPpm: 500_000, impactNotional: uint64(lib.OneMillion), + openInterestLowerCap: 0, + openInterestUpperCap: 0, expectedError: errorsmod.Wrap(types.ErrInitialMarginPpmExceedsMax, fmt.Sprint(lib.OneMillion+1)), }, "Maintenance Fraction Ppm exceeds maximum": { @@ -2927,6 +2939,8 @@ func TestSetLiquidityTier_New_Failure(t *testing.T) { initialMarginPpm: 500_000, maintenanceFractionPpm: lib.OneMillion + 1, impactNotional: uint64(lib.OneMillion), + openInterestLowerCap: 0, + openInterestUpperCap: 0, expectedError: errorsmod.Wrap(types.ErrMaintenanceFractionPpmExceedsMax, fmt.Sprint(lib.OneMillion+1)), }, "Impact Notional is zero": { @@ -2935,6 +2949,8 @@ func TestSetLiquidityTier_New_Failure(t *testing.T) { initialMarginPpm: 500_000, maintenanceFractionPpm: lib.OneMillion, impactNotional: uint64(0), + openInterestLowerCap: 0, + openInterestUpperCap: 0, expectedError: types.ErrImpactNotionalIsZero, }, } @@ -2952,6 +2968,8 @@ func TestSetLiquidityTier_New_Failure(t *testing.T) { tc.initialMarginPpm, tc.maintenanceFractionPpm, tc.impactNotional, + tc.openInterestLowerCap, + tc.openInterestUpperCap, ) require.Error(t, err) @@ -2970,6 +2988,8 @@ func TestModifyLiquidityTier_Success(t *testing.T) { lt.InitialMarginPpm, lt.MaintenanceFractionPpm, lt.ImpactNotional, + lt.OpenInterestLowerCap, + lt.OpenInterestUpperCap, ) require.NoError(t, err) } @@ -2981,6 +3001,8 @@ func TestModifyLiquidityTier_Success(t *testing.T) { initialMarginPpm := uint32(i * 2) maintenanceFractionPpm := uint32(i * 2) impactNotional := uint64((i + 1) * 500_000_000) + openInterestLowerCap := uint64(0) + openInterestUpperCap := uint64(0) modifiedLt, err := pc.PerpetualsKeeper.SetLiquidityTier( pc.Ctx, lt.Id, @@ -2988,6 +3010,8 @@ func TestModifyLiquidityTier_Success(t *testing.T) { initialMarginPpm, maintenanceFractionPpm, impactNotional, + openInterestLowerCap, + openInterestUpperCap, ) require.NoError(t, err) obtainedLt, err := pc.PerpetualsKeeper.GetLiquidityTier(pc.Ctx, lt.Id) @@ -3029,6 +3053,8 @@ func TestSetLiquidityTier_Existing_Failure(t *testing.T) { initialMarginPpm uint32 maintenanceFractionPpm uint32 impactNotional uint64 + openInterestLowerCap uint64 + openInterestUpperCap uint64 expectedError error }{ "Initial Margin Ppm exceeds maximum": { @@ -3037,6 +3063,8 @@ func TestSetLiquidityTier_Existing_Failure(t *testing.T) { initialMarginPpm: lib.OneMillion + 1, maintenanceFractionPpm: 500_000, impactNotional: uint64(lib.OneMillion), + openInterestLowerCap: 0, + openInterestUpperCap: 0, expectedError: errorsmod.Wrap(types.ErrInitialMarginPpmExceedsMax, fmt.Sprint(lib.OneMillion+1)), }, "Maintenance Fraction Ppm exceeds maximum": { @@ -3045,6 +3073,8 @@ func TestSetLiquidityTier_Existing_Failure(t *testing.T) { initialMarginPpm: 500_000, maintenanceFractionPpm: lib.OneMillion + 1, impactNotional: uint64(lib.OneMillion), + openInterestLowerCap: 0, + openInterestUpperCap: 0, expectedError: errorsmod.Wrap(types.ErrMaintenanceFractionPpmExceedsMax, fmt.Sprint(lib.OneMillion+1)), }, "Impact Notional is zero": { @@ -3053,8 +3083,25 @@ func TestSetLiquidityTier_Existing_Failure(t *testing.T) { initialMarginPpm: 500_000, maintenanceFractionPpm: lib.OneMillion, impactNotional: uint64(0), + openInterestLowerCap: 0, + openInterestUpperCap: 0, expectedError: types.ErrImpactNotionalIsZero, }, + "Invalid open interest caps": { + id: 1, + name: "Small-Cap", + initialMarginPpm: 500_000, + maintenanceFractionPpm: lib.OneMillion, + impactNotional: uint64(lib.OneMillion), + openInterestLowerCap: 50_000_000_000_000, + openInterestUpperCap: 25_000_000_000_000, + expectedError: errorsmod.Wrapf( + types.ErrOpenInterestLowerCapLargerThanUpperCap, + "open_interest_lower_cap: %d, open_interest_upper_cap: %d", + 50_000_000_000_000, + 25_000_000_000_000, + ), + }, } // Test setup. @@ -3071,6 +3118,8 @@ func TestSetLiquidityTier_Existing_Failure(t *testing.T) { tc.initialMarginPpm, tc.maintenanceFractionPpm, tc.impactNotional, + tc.openInterestLowerCap, + tc.openInterestUpperCap, ) require.Error(t, err) diff --git a/protocol/x/perpetuals/module_test.go b/protocol/x/perpetuals/module_test.go index 7802a105d1..68147a9afc 100644 --- a/protocol/x/perpetuals/module_test.go +++ b/protocol/x/perpetuals/module_test.go @@ -282,7 +282,9 @@ func TestAppModule_InitExportGenesis(t *testing.T) { "name":"Large-Cap", "initial_margin_ppm":50000, "maintenance_fraction_ppm":500000, - "impact_notional":10000000000 + "impact_notional":10000000000, + "open_interest_lower_cap":25000000000000, + "open_interest_upper_cap":50000000000000 } ], "params":{ @@ -314,7 +316,8 @@ func TestAppModule_InitExportGenesis(t *testing.T) { "liquidity_tier":0, "market_type":"PERPETUAL_MARKET_TYPE_CROSS" }, - "funding_index":"0" + "funding_index":"0", + "open_interest":"0" } ], "liquidity_tiers":[ @@ -324,7 +327,9 @@ func TestAppModule_InitExportGenesis(t *testing.T) { "initial_margin_ppm":50000, "maintenance_fraction_ppm":500000, "base_position_notional":"0", - "impact_notional":"10000000000" + "impact_notional":"10000000000", + "open_interest_lower_cap":"25000000000000", + "open_interest_upper_cap":"50000000000000" } ], "params":{ diff --git a/protocol/x/perpetuals/simulation/genesis.go b/protocol/x/perpetuals/simulation/genesis.go index 7addb08818..b68e5cbe6f 100644 --- a/protocol/x/perpetuals/simulation/genesis.go +++ b/protocol/x/perpetuals/simulation/genesis.go @@ -190,9 +190,7 @@ func RandomizedGenState(simState *module.SimulationState) { marketId := marketsForPerp[i] marketType := types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS - if i%2 == 0 { - marketType = types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_ISOLATED - } + // TODO: add isolated markets when order placements for isolated markets are supported perpetuals[i] = types.Perpetual{ Params: types.PerpetualParams{ @@ -205,6 +203,7 @@ func RandomizedGenState(simState *module.SimulationState) { MarketType: marketType, }, FundingIndex: dtypes.ZeroInt(), + OpenInterest: dtypes.ZeroInt(), } } diff --git a/protocol/x/perpetuals/types/errors.go b/protocol/x/perpetuals/types/errors.go index e7e0aed8c8..50f04d5c40 100644 --- a/protocol/x/perpetuals/types/errors.go +++ b/protocol/x/perpetuals/types/errors.go @@ -112,6 +112,11 @@ var ( 23, "Market type is invalid", ) + ErrOpenInterestLowerCapLargerThanUpperCap = errorsmod.Register( + ModuleName, + 24, + "open interest lower cap is larger than upper cap", + ) // Errors for Not Implemented ErrNotImplementedFunding = errorsmod.Register(ModuleName, 1001, "Not Implemented: Perpetuals Funding") diff --git a/protocol/x/perpetuals/types/liquidity_tier.go b/protocol/x/perpetuals/types/liquidity_tier.go index 957e5dfd87..2af218d04c 100644 --- a/protocol/x/perpetuals/types/liquidity_tier.go +++ b/protocol/x/perpetuals/types/liquidity_tier.go @@ -24,6 +24,15 @@ func (liquidityTier LiquidityTier) Validate() error { return ErrImpactNotionalIsZero } + if liquidityTier.OpenInterestLowerCap > liquidityTier.OpenInterestUpperCap { + return errorsmod.Wrapf( + ErrOpenInterestLowerCapLargerThanUpperCap, + "open_interest_lower_cap: %d, open_interest_upper_cap: %d", + liquidityTier.OpenInterestLowerCap, + liquidityTier.OpenInterestUpperCap, + ) + } + return nil } diff --git a/protocol/x/perpetuals/types/perpetual.pb.go b/protocol/x/perpetuals/types/perpetual.pb.go index 6072e4dbea..2325712744 100644 --- a/protocol/x/perpetuals/types/perpetual.pb.go +++ b/protocol/x/perpetuals/types/perpetual.pb.go @@ -62,6 +62,8 @@ type Perpetual struct { // The current index determined by the cumulative all-time // history of the funding mechanism. Starts at zero. FundingIndex github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,2,opt,name=funding_index,json=fundingIndex,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"funding_index"` + // Total size of open long contracts, measured in base_quantums. + OpenInterest github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,3,opt,name=open_interest,json=openInterest,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"open_interest"` } func (m *Perpetual) Reset() { *m = Perpetual{} } @@ -360,6 +362,13 @@ type LiquidityTier struct { // - Impact ask price = average execution price for a market buy of the // impact notional value. ImpactNotional uint64 `protobuf:"varint,6,opt,name=impact_notional,json=impactNotional,proto3" json:"impact_notional,omitempty"` + // Lower cap for Open Interest Margin Fracton (OIMF), in quote quantums. + // IMF is not affected when OI <= open_interest_lower_cap. + OpenInterestLowerCap uint64 `protobuf:"varint,7,opt,name=open_interest_lower_cap,json=openInterestLowerCap,proto3" json:"open_interest_lower_cap,omitempty"` + // Upper cap for Open Interest Margin Fracton (OIMF), in quote quantums. + // IMF scales linearly to 100% as OI approaches open_interest_upper_cap. + // If zero, then the IMF does not scale with OI. + OpenInterestUpperCap uint64 `protobuf:"varint,8,opt,name=open_interest_upper_cap,json=openInterestUpperCap,proto3" json:"open_interest_upper_cap,omitempty"` } func (m *LiquidityTier) Reset() { *m = LiquidityTier{} } @@ -438,6 +447,20 @@ func (m *LiquidityTier) GetImpactNotional() uint64 { return 0 } +func (m *LiquidityTier) GetOpenInterestLowerCap() uint64 { + if m != nil { + return m.OpenInterestLowerCap + } + return 0 +} + +func (m *LiquidityTier) GetOpenInterestUpperCap() uint64 { + if m != nil { + return m.OpenInterestUpperCap + } + return 0 +} + func init() { proto.RegisterEnum("dydxprotocol.perpetuals.PerpetualMarketType", PerpetualMarketType_name, PerpetualMarketType_value) proto.RegisterType((*Perpetual)(nil), "dydxprotocol.perpetuals.Perpetual") @@ -452,51 +475,55 @@ func init() { } var fileDescriptor_ce7204eee10038be = []byte{ - // 696 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x4f, 0xdb, 0x3e, - 0x18, 0xae, 0x4b, 0x7f, 0xfd, 0x81, 0xfb, 0x87, 0xd6, 0x20, 0x16, 0x81, 0x54, 0x4a, 0x25, 0x44, - 0xb5, 0xb1, 0x56, 0x62, 0x3b, 0xec, 0xb0, 0xc3, 0x28, 0xb4, 0x5a, 0x35, 0x0a, 0x51, 0x5a, 0x26, - 0x6d, 0xd2, 0x14, 0xb9, 0x89, 0x29, 0x16, 0xb1, 0x93, 0x25, 0xce, 0x44, 0x77, 0xdb, 0x37, 0xe0, - 0x6b, 0xec, 0x6b, 0xec, 0xc4, 0x91, 0xe3, 0xb4, 0x03, 0x9a, 0xe0, 0x7b, 0x4c, 0x53, 0x1c, 0x37, - 0x14, 0x06, 0xda, 0x4e, 0x7d, 0xfd, 0x3e, 0xcf, 0xf3, 0xf6, 0xb1, 0xfd, 0xc4, 0x70, 0xc3, 0x1e, - 0xdb, 0xa7, 0x9e, 0xef, 0x0a, 0xd7, 0x72, 0x9d, 0xa6, 0x47, 0x7c, 0x8f, 0x88, 0x10, 0x3b, 0xc1, - 0x4d, 0xd9, 0x90, 0x28, 0x7a, 0x34, 0x4d, 0x6c, 0xdc, 0x10, 0x97, 0x17, 0x47, 0xee, 0xc8, 0x95, - 0x40, 0x33, 0xaa, 0x62, 0x7a, 0xed, 0x1b, 0x80, 0x73, 0xfa, 0x84, 0x84, 0x3a, 0x30, 0xeb, 0x61, - 0x1f, 0xb3, 0x40, 0x03, 0x55, 0x50, 0xcf, 0x6d, 0xd5, 0x1b, 0x0f, 0x4c, 0x6b, 0x24, 0x1a, 0x5d, - 0xf2, 0x5b, 0x99, 0xf3, 0xcb, 0xd5, 0x94, 0xa1, 0xd4, 0x88, 0xc1, 0xc2, 0x51, 0xc8, 0x6d, 0xca, - 0x47, 0x26, 0xe5, 0x36, 0x39, 0xd5, 0xd2, 0x55, 0x50, 0xcf, 0xb7, 0x5e, 0x47, 0xa4, 0x1f, 0x97, - 0xab, 0xaf, 0x46, 0x54, 0x1c, 0x87, 0xc3, 0x86, 0xe5, 0xb2, 0xe6, 0xad, 0x7d, 0x7d, 0x7a, 0xfe, - 0xd4, 0x3a, 0xc6, 0x94, 0x37, 0x93, 0x8e, 0x2d, 0xc6, 0x1e, 0x09, 0x1a, 0x7d, 0xe2, 0x53, 0xec, - 0xd0, 0xcf, 0x78, 0xe8, 0x90, 0x2e, 0x17, 0x46, 0x5e, 0x8d, 0xef, 0x46, 0xd3, 0x6b, 0x5f, 0xd3, - 0x70, 0xfe, 0x8e, 0x21, 0x54, 0x84, 0x69, 0x6a, 0xcb, 0x6d, 0x14, 0x8c, 0x34, 0xb5, 0xd1, 0x12, - 0xcc, 0x0a, 0x6a, 0x9d, 0x10, 0x5f, 0x7a, 0x99, 0x33, 0xd4, 0x0a, 0xad, 0xc0, 0x39, 0x86, 0xfd, - 0x13, 0x22, 0x4c, 0x6a, 0x6b, 0x33, 0x92, 0x3e, 0x1b, 0x37, 0xba, 0x36, 0x7a, 0x02, 0xcb, 0x58, - 0xb8, 0x8c, 0x5a, 0xa6, 0x4f, 0x02, 0xd7, 0x09, 0x05, 0x75, 0xb9, 0x96, 0xa9, 0x82, 0x7a, 0xd9, - 0x28, 0xc5, 0x80, 0x91, 0xf4, 0x51, 0x03, 0x2e, 0xd8, 0xe4, 0x08, 0x87, 0x8e, 0x30, 0x27, 0x9b, - 0xf7, 0x3c, 0xa6, 0xfd, 0x27, 0xe9, 0x65, 0x05, 0x75, 0x62, 0x44, 0xf7, 0x18, 0x5a, 0x87, 0x45, - 0x87, 0x7e, 0x0c, 0xa9, 0x4d, 0xc5, 0xd8, 0x14, 0x94, 0xf8, 0x5a, 0x56, 0xfe, 0x7d, 0x21, 0xe9, - 0x0e, 0x28, 0xf1, 0x51, 0x0f, 0xe6, 0x94, 0xc1, 0xe8, 0x28, 0xb4, 0xff, 0xab, 0xa0, 0x5e, 0xdc, - 0xda, 0xfc, 0xfb, 0xc5, 0xf4, 0xa4, 0x68, 0x30, 0xf6, 0x88, 0x01, 0x59, 0x52, 0xd7, 0x0e, 0x60, - 0x31, 0x46, 0x74, 0x9f, 0x30, 0x1a, 0xb2, 0x00, 0xad, 0xc1, 0x7c, 0xa2, 0x37, 0x93, 0x33, 0xcb, - 0x25, 0xbd, 0xae, 0x8d, 0x96, 0xe1, 0xac, 0xa7, 0xe8, 0x5a, 0xba, 0x3a, 0x53, 0x2f, 0x1b, 0xc9, - 0xba, 0x76, 0x06, 0x60, 0x5e, 0xcd, 0xea, 0x0b, 0xd7, 0x27, 0xe8, 0x03, 0x5c, 0xc0, 0x8e, 0x63, - 0x2a, 0xd3, 0x89, 0x0e, 0x54, 0x67, 0xea, 0xb9, 0xad, 0x8d, 0x07, 0x8d, 0xdf, 0x76, 0xa5, 0x02, - 0x55, 0xc6, 0x8e, 0xf3, 0xa7, 0x5d, 0x1e, 0x32, 0x73, 0xca, 0x8f, 0xb4, 0xcb, 0x43, 0x36, 0xa1, - 0xd4, 0x7e, 0x01, 0x58, 0xd8, 0xbb, 0x75, 0x88, 0x77, 0xd3, 0x80, 0x60, 0x86, 0x63, 0x46, 0x54, - 0x16, 0x64, 0x8d, 0x36, 0x21, 0xa2, 0x9c, 0x0a, 0x8a, 0xa5, 0xf7, 0x11, 0xe5, 0xf2, 0xfa, 0xe2, - 0x48, 0x94, 0x14, 0xd2, 0x93, 0x40, 0x74, 0x7b, 0x2f, 0xa0, 0xc6, 0x30, 0xe5, 0x82, 0x70, 0xcc, - 0x2d, 0x62, 0x1e, 0xf9, 0xd8, 0x8a, 0x52, 0x20, 0x35, 0x19, 0xa9, 0x59, 0x9a, 0xc2, 0x3b, 0x0a, - 0x8e, 0x95, 0x4b, 0x43, 0x1c, 0x10, 0xd3, 0x73, 0x03, 0x2a, 0x25, 0xdc, 0x8d, 0x7e, 0xb0, 0x23, - 0xa3, 0x92, 0x69, 0xa5, 0x35, 0x60, 0x2c, 0x46, 0x0c, 0x5d, 0x11, 0xf6, 0x15, 0x8e, 0x36, 0xe0, - 0x3c, 0x65, 0x1e, 0xb6, 0xc4, 0x8d, 0x24, 0x8a, 0x4c, 0xc6, 0x28, 0xc6, 0xed, 0x09, 0xf1, 0xf1, - 0x17, 0x00, 0x17, 0xee, 0x09, 0x02, 0x5a, 0x87, 0x6b, 0x7a, 0xdb, 0xd0, 0xdb, 0x83, 0xc3, 0xed, - 0x3d, 0xb3, 0xb7, 0x6d, 0xbc, 0x69, 0x0f, 0xcc, 0xc1, 0x3b, 0xbd, 0x6d, 0x1e, 0xee, 0xf7, 0xf5, - 0xf6, 0x4e, 0xb7, 0xd3, 0x6d, 0xef, 0x96, 0x52, 0x68, 0x15, 0xae, 0xdc, 0x4f, 0xdb, 0x31, 0x0e, - 0xfa, 0xfd, 0x12, 0x40, 0x35, 0x58, 0xb9, 0x9f, 0xd0, 0xed, 0x1f, 0xec, 0x6d, 0x0f, 0xda, 0xbb, - 0xa5, 0x74, 0xeb, 0xed, 0xf9, 0x55, 0x05, 0x5c, 0x5c, 0x55, 0xc0, 0xcf, 0xab, 0x0a, 0x38, 0xbb, - 0xae, 0xa4, 0x2e, 0xae, 0x2b, 0xa9, 0xef, 0xd7, 0x95, 0xd4, 0xfb, 0x97, 0xff, 0xfe, 0xf9, 0x9f, - 0x4e, 0x3f, 0x75, 0xf2, 0x29, 0x18, 0x66, 0x25, 0xf8, 0xec, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xc6, 0x3a, 0xfc, 0x1e, 0x12, 0x05, 0x00, 0x00, + // 758 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xf3, 0x44, + 0x14, 0x8d, 0xdd, 0x10, 0xda, 0xc9, 0xcf, 0x97, 0x4c, 0xab, 0x7e, 0x56, 0x2b, 0xa5, 0x69, 0xa4, + 0xaa, 0x11, 0x94, 0x44, 0x2a, 0x20, 0xb1, 0x60, 0x41, 0x93, 0x26, 0xc2, 0x22, 0x69, 0x2d, 0x27, + 0x45, 0x02, 0x09, 0x8d, 0x26, 0xf6, 0x34, 0x1d, 0xd5, 0x1e, 0x0f, 0xf6, 0x18, 0x1a, 0x76, 0xbc, + 0x41, 0x5f, 0x83, 0x25, 0x6f, 0xd1, 0x65, 0x97, 0x88, 0x45, 0x85, 0xda, 0x2d, 0x0f, 0x81, 0x3c, + 0x9e, 0xba, 0x49, 0x7f, 0x04, 0x0b, 0x56, 0x1e, 0xdf, 0x73, 0xce, 0x9d, 0x33, 0xd7, 0xc7, 0x03, + 0xf6, 0xdd, 0xb9, 0x7b, 0xc5, 0xc3, 0x40, 0x04, 0x4e, 0xe0, 0x75, 0x38, 0x09, 0x39, 0x11, 0x31, + 0xf6, 0xa2, 0xa7, 0x65, 0x5b, 0xa2, 0xf0, 0xfd, 0x22, 0xb1, 0xfd, 0x44, 0xdc, 0xda, 0x98, 0x05, + 0xb3, 0x40, 0x02, 0x9d, 0x64, 0x95, 0xd2, 0x9b, 0xbf, 0xeb, 0x60, 0xcd, 0x7a, 0x24, 0xc1, 0x01, + 0x28, 0x70, 0x1c, 0x62, 0x3f, 0x32, 0xb4, 0x86, 0xd6, 0x2a, 0x1e, 0xb6, 0xda, 0x6f, 0x74, 0x6b, + 0x67, 0x1a, 0x4b, 0xf2, 0xbb, 0xf9, 0x9b, 0xbb, 0x9d, 0x9c, 0xad, 0xd4, 0xd0, 0x07, 0xe5, 0xf3, + 0x98, 0xb9, 0x94, 0xcd, 0x10, 0x65, 0x2e, 0xb9, 0x32, 0xf4, 0x86, 0xd6, 0x2a, 0x75, 0xbf, 0x4e, + 0x48, 0x7f, 0xde, 0xed, 0x7c, 0x35, 0xa3, 0xe2, 0x22, 0x9e, 0xb6, 0x9d, 0xc0, 0xef, 0x2c, 0x9d, + 0xeb, 0xa7, 0xcf, 0x3e, 0x71, 0x2e, 0x30, 0x65, 0x9d, 0xac, 0xe2, 0x8a, 0x39, 0x27, 0x51, 0x7b, + 0x4c, 0x42, 0x8a, 0x3d, 0xfa, 0x0b, 0x9e, 0x7a, 0xc4, 0x64, 0xc2, 0x2e, 0xa9, 0xf6, 0x66, 0xd2, + 0x3d, 0xd9, 0x2e, 0xe0, 0x84, 0x21, 0xca, 0x04, 0x09, 0x49, 0x24, 0x8c, 0x95, 0xff, 0x7b, 0xbb, + 0xa4, 0xbd, 0xa9, 0xba, 0x37, 0x7f, 0xd3, 0xc1, 0xbb, 0x67, 0xe7, 0x87, 0x15, 0xa0, 0x53, 0x57, + 0x4e, 0xad, 0x6c, 0xeb, 0xd4, 0x85, 0x9b, 0xa0, 0x20, 0xa8, 0x73, 0x49, 0x42, 0x79, 0xf4, 0x35, + 0x5b, 0xbd, 0xc1, 0x6d, 0xb0, 0xe6, 0xe3, 0xf0, 0x92, 0x08, 0x44, 0x5d, 0x69, 0xb3, 0x6c, 0xaf, + 0xa6, 0x05, 0xd3, 0x85, 0x1f, 0x83, 0x1a, 0x16, 0x81, 0x4f, 0x1d, 0x14, 0x92, 0x28, 0xf0, 0x62, + 0x41, 0x03, 0x66, 0xe4, 0x1b, 0x5a, 0xab, 0x66, 0x57, 0x53, 0xc0, 0xce, 0xea, 0xb0, 0x0d, 0xd6, + 0x5d, 0x72, 0x8e, 0x63, 0x4f, 0xa0, 0xc7, 0x59, 0x73, 0xee, 0x1b, 0x1f, 0x48, 0x7a, 0x4d, 0x41, + 0x83, 0x14, 0xb1, 0xb8, 0x0f, 0xf7, 0x40, 0xc5, 0xa3, 0x3f, 0xc6, 0xd4, 0xa5, 0x62, 0x8e, 0x04, + 0x25, 0xa1, 0x51, 0x90, 0xdb, 0x97, 0xb3, 0xea, 0x84, 0x92, 0x10, 0x8e, 0x40, 0x51, 0x19, 0x4c, + 0x46, 0x61, 0x7c, 0xd8, 0xd0, 0x5a, 0x95, 0xc3, 0x83, 0x7f, 0xcf, 0xc1, 0x48, 0x8a, 0x26, 0x73, + 0x4e, 0x6c, 0xe0, 0x67, 0xeb, 0xe6, 0x29, 0xa8, 0xa4, 0x88, 0x15, 0x12, 0x9f, 0xc6, 0x7e, 0x04, + 0x77, 0x41, 0x29, 0xd3, 0xa3, 0x6c, 0x66, 0xc5, 0xac, 0x66, 0xba, 0x70, 0x0b, 0xac, 0x72, 0x45, + 0x37, 0xf4, 0xc6, 0x4a, 0xab, 0x66, 0x67, 0xef, 0xcd, 0x6b, 0x0d, 0x94, 0x54, 0xaf, 0xb1, 0x08, + 0x42, 0x02, 0x7f, 0x00, 0xeb, 0xd8, 0xf3, 0x90, 0x32, 0x9d, 0xe9, 0xb4, 0xc6, 0x4a, 0xab, 0x78, + 0xb8, 0xff, 0xa6, 0xf1, 0x65, 0x57, 0x2a, 0xbf, 0x35, 0xec, 0x79, 0x2f, 0xed, 0xb2, 0xd8, 0x47, + 0x0b, 0x7e, 0xa4, 0x5d, 0x16, 0xfb, 0x8f, 0x94, 0xe6, 0xdf, 0x3a, 0x28, 0x0f, 0x97, 0x86, 0xf8, + 0x3c, 0x0d, 0x10, 0xe4, 0x19, 0xf6, 0x89, 0xca, 0x82, 0x5c, 0xc3, 0x03, 0x00, 0x29, 0xa3, 0x82, + 0x62, 0xe9, 0x7d, 0x46, 0x99, 0xfc, 0x7c, 0x69, 0x24, 0xaa, 0x0a, 0x19, 0x49, 0x20, 0xf9, 0x7a, + 0x5f, 0x00, 0xc3, 0xc7, 0x49, 0xbe, 0x19, 0x66, 0x0e, 0x41, 0xe7, 0x21, 0x76, 0x92, 0x14, 0x48, + 0x4d, 0x5e, 0x6a, 0x36, 0x17, 0xf0, 0x81, 0x82, 0x53, 0xe5, 0xe6, 0x14, 0x47, 0x04, 0xf1, 0x20, + 0xa2, 0x52, 0xc2, 0x82, 0xe4, 0x81, 0x3d, 0x19, 0x95, 0x7c, 0x57, 0x37, 0x34, 0x7b, 0x23, 0x61, + 0x58, 0x8a, 0x70, 0xa2, 0x70, 0xb8, 0x0f, 0xde, 0x51, 0x9f, 0x63, 0x47, 0x3c, 0x49, 0x92, 0xc8, + 0xe4, 0xed, 0x4a, 0x5a, 0xce, 0x88, 0x9f, 0x83, 0xf7, 0x4b, 0xff, 0x1f, 0xf2, 0x82, 0x9f, 0x49, + 0x88, 0x1c, 0xcc, 0x65, 0x7e, 0xf2, 0xf6, 0xc6, 0xe2, 0xff, 0x33, 0x4c, 0xc0, 0x1e, 0xe6, 0x2f, + 0x65, 0x31, 0xe7, 0x4a, 0xb6, 0xfa, 0x52, 0x76, 0x96, 0x80, 0x3d, 0xcc, 0x3f, 0xfa, 0x55, 0x03, + 0xeb, 0xaf, 0xc4, 0x0e, 0xee, 0x81, 0x5d, 0xab, 0x6f, 0x5b, 0xfd, 0xc9, 0xd9, 0xd1, 0x10, 0x8d, + 0x8e, 0xec, 0x6f, 0xfa, 0x13, 0x34, 0xf9, 0xce, 0xea, 0xa3, 0xb3, 0x93, 0xb1, 0xd5, 0xef, 0x99, + 0x03, 0xb3, 0x7f, 0x5c, 0xcd, 0xc1, 0x1d, 0xb0, 0xfd, 0x3a, 0xad, 0x67, 0x9f, 0x8e, 0xc7, 0x55, + 0x0d, 0x36, 0x41, 0xfd, 0x75, 0x82, 0x39, 0x3e, 0x1d, 0x1e, 0x4d, 0xfa, 0xc7, 0x55, 0xbd, 0xfb, + 0xed, 0xcd, 0x7d, 0x5d, 0xbb, 0xbd, 0xaf, 0x6b, 0x7f, 0xdd, 0xd7, 0xb5, 0xeb, 0x87, 0x7a, 0xee, + 0xf6, 0xa1, 0x9e, 0xfb, 0xe3, 0xa1, 0x9e, 0xfb, 0xfe, 0xcb, 0xff, 0x7e, 0xd9, 0x5c, 0x2d, 0xde, + 0xe3, 0xf2, 0xe2, 0x99, 0x16, 0x24, 0xf8, 0xe9, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x28, + 0x1e, 0x85, 0xef, 0x05, 0x00, 0x00, } func (m *Perpetual) Marshal() (dAtA []byte, err error) { @@ -519,6 +546,16 @@ func (m *Perpetual) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.OpenInterest.Size() + i -= size + if _, err := m.OpenInterest.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPerpetual(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a { size := m.FundingIndex.Size() i -= size @@ -711,6 +748,16 @@ func (m *LiquidityTier) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.OpenInterestUpperCap != 0 { + i = encodeVarintPerpetual(dAtA, i, uint64(m.OpenInterestUpperCap)) + i-- + dAtA[i] = 0x40 + } + if m.OpenInterestLowerCap != 0 { + i = encodeVarintPerpetual(dAtA, i, uint64(m.OpenInterestLowerCap)) + i-- + dAtA[i] = 0x38 + } if m.ImpactNotional != 0 { i = encodeVarintPerpetual(dAtA, i, uint64(m.ImpactNotional)) i-- @@ -767,6 +814,8 @@ func (m *Perpetual) Size() (n int) { n += 1 + l + sovPerpetual(uint64(l)) l = m.FundingIndex.Size() n += 1 + l + sovPerpetual(uint64(l)) + l = m.OpenInterest.Size() + n += 1 + l + sovPerpetual(uint64(l)) return n } @@ -863,6 +912,12 @@ func (m *LiquidityTier) Size() (n int) { if m.ImpactNotional != 0 { n += 1 + sovPerpetual(uint64(m.ImpactNotional)) } + if m.OpenInterestLowerCap != 0 { + n += 1 + sovPerpetual(uint64(m.OpenInterestLowerCap)) + } + if m.OpenInterestUpperCap != 0 { + n += 1 + sovPerpetual(uint64(m.OpenInterestUpperCap)) + } return n } @@ -967,6 +1022,39 @@ func (m *Perpetual) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OpenInterest", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetual + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPerpetual + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPerpetual + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OpenInterest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPerpetual(dAtA[iNdEx:]) @@ -1594,6 +1682,44 @@ func (m *LiquidityTier) Unmarshal(dAtA []byte) error { break } } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OpenInterestLowerCap", wireType) + } + m.OpenInterestLowerCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetual + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OpenInterestLowerCap |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OpenInterestUpperCap", wireType) + } + m.OpenInterestUpperCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetual + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OpenInterestUpperCap |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipPerpetual(dAtA[iNdEx:]) diff --git a/protocol/x/perpetuals/types/types.go b/protocol/x/perpetuals/types/types.go index b6c2d895c5..84cfaacd6e 100644 --- a/protocol/x/perpetuals/types/types.go +++ b/protocol/x/perpetuals/types/types.go @@ -93,6 +93,8 @@ type PerpetualsKeeper interface { initialMarginPpm uint32, maintenanceFractionPpm uint32, impactNotional uint64, + openInterestLowerCap uint64, + openInterestUpperCap uint64, ) ( liquidityTier LiquidityTier, err error, diff --git a/protocol/x/subaccounts/keeper/subaccount.go b/protocol/x/subaccounts/keeper/subaccount.go index 4ec9bb9158..c881a48064 100644 --- a/protocol/x/subaccounts/keeper/subaccount.go +++ b/protocol/x/subaccounts/keeper/subaccount.go @@ -62,39 +62,28 @@ func (k Keeper) GetCollateralPoolForSubaccount(ctx sdk.Context, subaccountId typ sdk.AccAddress, error, ) { - poolName, err := k.GetCollateralPoolNameForSubaccount(ctx, subaccountId) - if err != nil { - return nil, err - } - return authtypes.NewModuleAddress(poolName), nil -} - -func (k Keeper) GetCollateralPoolNameForSubaccount(ctx sdk.Context, subaccountId types.SubaccountId) (string, error) { + // Use the default collateral pool if the subaccount has no perpetual positions. subaccount := k.GetSubaccount(ctx, subaccountId) if len(subaccount.PerpetualPositions) == 0 { - return types.ModuleName, nil + return types.ModuleAddress, nil } - // Get the first perpetual position and return the collateral pool name. - perpetual, err := k.perpetualsKeeper.GetPerpetual(ctx, subaccount.PerpetualPositions[0].PerpetualId) + return k.GetCollateralPoolFromPerpetualId(ctx, subaccount.PerpetualPositions[0].PerpetualId) +} + +// GetCollateralPoolForSubaccountWithPerpetuals returns the collateral pool address based on the +// perpetual passed in as an argument. +func (k Keeper) GetCollateralPoolFromPerpetualId(ctx sdk.Context, perpetualId uint32) (sdk.AccAddress, error) { + perpetual, err := k.perpetualsKeeper.GetPerpetual(ctx, perpetualId) if err != nil { - panic(fmt.Sprintf("GetCollateralPoolNameForSubaccount: %v", err)) + return nil, err } if perpetual.Params.MarketType == perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_ISOLATED { - return types.ModuleName + ":" + lib.UintToString(perpetual.GetId()), nil + return authtypes.NewModuleAddress(types.ModuleName + ":" + lib.UintToString(perpetual.GetId())), nil } - return types.ModuleName, nil -} - -// IsIsolatedMarketSubaccount returns whether a subaccount is isolated to a specific market. -func (k Keeper) IsIsolatedMarketSubaccount(ctx sdk.Context, subaccountId types.SubaccountId) (bool, error) { - poolName, err := k.GetCollateralPoolNameForSubaccount(ctx, subaccountId) - if err != nil { - panic(fmt.Sprintf("IsIsolatedMarketSubaccount: %v", err)) - } - return poolName != types.ModuleName, nil + return authtypes.NewModuleAddress(types.ModuleName), nil } // GetSubaccount returns a subaccount from its index. diff --git a/protocol/x/subaccounts/keeper/transfer.go b/protocol/x/subaccounts/keeper/transfer.go index 6e6ef31e3b..d556426f4b 100644 --- a/protocol/x/subaccounts/keeper/transfer.go +++ b/protocol/x/subaccounts/keeper/transfer.go @@ -123,11 +123,16 @@ func (k Keeper) DepositFundsFromAccountToSubaccount( return err } + collateralPoolAddr, err := k.GetCollateralPoolForSubaccount(ctx, toSubaccountId) + if err != nil { + return err + } + // Send coins from `fromModule` to the `subaccounts` module account. - if err := k.bankKeeper.SendCoinsFromAccountToModule( + if err := k.bankKeeper.SendCoins( ctx, fromAccount, - types.ModuleName, + collateralPoolAddr, []sdk.Coin{coinToTransfer}, ); err != nil { return err @@ -143,7 +148,7 @@ func (k Keeper) DepositFundsFromAccountToSubaccount( // WithdrawFundsFromSubaccountToAccount returns an error if the call to `k.CanUpdateSubaccounts()` // fails. Otherwise, deducts the asset quantums from the subaccount, translates the -// `assetId` and `quantums` into a `sdk.Coin`, and calls `bankKeeper.SendCoinsFromModuleToAccount()`. +// `assetId` and `quantums` into a `sdk.Coin`, and calls `bankKeeper.SendCoins()`. func (k Keeper) WithdrawFundsFromSubaccountToAccount( ctx sdk.Context, fromSubaccountId types.SubaccountId, @@ -181,10 +186,15 @@ func (k Keeper) WithdrawFundsFromSubaccountToAccount( return err } + collateralPoolAddr, err := k.GetCollateralPoolForSubaccount(ctx, fromSubaccountId) + if err != nil { + return err + } + // Send coins from `fromModule` to the `subaccounts` module account. - if err := k.bankKeeper.SendCoinsFromModuleToAccount( + if err := k.bankKeeper.SendCoins( ctx, - types.ModuleName, + collateralPoolAddr, toAccount, []sdk.Coin{coinToTransfer}, ); err != nil { @@ -201,11 +211,12 @@ func (k Keeper) WithdrawFundsFromSubaccountToAccount( // TransferFeesToFeeCollectorModule translates the assetId and quantums into a sdk.Coin, // and moves the funds from subaccounts module to the `fee_collector` module account by calling -// bankKeeper.SendCoinsFromModuleToModule(). Does not change any individual subaccount state. +// bankKeeper.SendCoins(). Does not change any individual subaccount state. func (k Keeper) TransferFeesToFeeCollectorModule( ctx sdk.Context, assetId uint32, quantums *big.Int, + perpetualId uint32, ) error { // TODO(DEC-715): Support non-USDC assets. if assetId != assettypes.AssetUsdc.Id { @@ -225,19 +236,24 @@ func (k Keeper) TransferFeesToFeeCollectorModule( return err } + collateralPoolAddr, err := k.GetCollateralPoolFromPerpetualId(ctx, perpetualId) + if err != nil { + return err + } + // Send coins from `subaccounts` to the `auth` module fee collector account. - fromModule := types.ModuleName - toModule := authtypes.FeeCollectorName + fromModuleAddr := collateralPoolAddr + toModuleAddr := authtypes.NewModuleAddress(authtypes.FeeCollectorName) if quantums.Sign() < 0 { // In the case of a liquidation, net fees can be negative if the maker gets a rebate. - fromModule, toModule = toModule, fromModule + fromModuleAddr, toModuleAddr = toModuleAddr, fromModuleAddr } - if err := k.bankKeeper.SendCoinsFromModuleToModule( + if err := k.bankKeeper.SendCoins( ctx, - fromModule, - toModule, + fromModuleAddr, + toModuleAddr, []sdk.Coin{coinToTransfer}, ); err != nil { return err @@ -247,7 +263,7 @@ func (k Keeper) TransferFeesToFeeCollectorModule( } // TransferInsuranceFundPayments transfers funds in and out of the insurance fund to the subaccounts -// module by calling `bankKeeper.SendCoinsFromModuleToModule`. +// module by calling `bankKeeper.SendCoins`. // This function transfers funds // - from the insurance fund to the subaccounts module when `insuranceFundDelta` is negative. // - from the subaccounts module to the insurance fund when `insuranceFundDelta` is positive. @@ -276,8 +292,11 @@ func (k Keeper) TransferInsuranceFundPayments( // Determine the sender and receiver. // Send coins from `subaccounts` to the `insurance_fund` module account by default. - fromModule := types.ModuleName - toModule, err := k.perpetualsKeeper.GetInsuranceFundName(ctx, perpetualId) + fromModule, err := k.GetCollateralPoolFromPerpetualId(ctx, perpetualId) + if err != nil { + panic(err) + } + toModule, err := k.perpetualsKeeper.GetInsuranceFundModuleAddress(ctx, perpetualId) if err != nil { panic(err) } @@ -292,8 +311,8 @@ func (k Keeper) TransferInsuranceFundPayments( // module account features return k.bankKeeper.SendCoins( ctx, - authtypes.NewModuleAddress(fromModule), - authtypes.NewModuleAddress(toModule), + fromModule, + toModule, []sdk.Coin{coinToTransfer}, ) } diff --git a/protocol/x/subaccounts/keeper/transfer_test.go b/protocol/x/subaccounts/keeper/transfer_test.go index 58ed6ff53c..831c963368 100644 --- a/protocol/x/subaccounts/keeper/transfer_test.go +++ b/protocol/x/subaccounts/keeper/transfer_test.go @@ -30,12 +30,15 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun asset asstypes.Asset // Subaccount state. - assetPositions []*types.AssetPosition + assetPositions []*types.AssetPosition + perpetualPositions []*types.PerpetualPosition // Module account state. subaccountModuleAccBalance *big.Int accAddressBalance *big.Int + collateralPoolAddr sdk.AccAddress + // Transfer details. quantums *big.Int @@ -46,12 +49,33 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun expectedAccAddressBalance *big.Int }{ "WithdrawFundsFromSubaccountToAccount: send from subaccount to an account address": { - testTransferFundToAccount: true, - asset: *constants.Usdc, - accAddressBalance: big.NewInt(2500), - subaccountModuleAccBalance: big.NewInt(600), - quantums: big.NewInt(500), - assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + testTransferFundToAccount: true, + asset: *constants.Usdc, + accAddressBalance: big.NewInt(2500), + subaccountModuleAccBalance: big.NewInt(600), + quantums: big.NewInt(500), + assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + perpetualPositions: []*types.PerpetualPosition{ + &constants.PerpetualPosition_OneBTCLong, + }, + collateralPoolAddr: types.ModuleAddress, + expectedQuoteBalance: big.NewInt(0), // 500 - 500 + expectedSubaccountsModuleAccBalance: big.NewInt(100), // 600 - 100 + expectedAccAddressBalance: big.NewInt(3000), // 500 + 2500 + }, + "WithdrawFundsFromSubaccountToAccount: send from isolated subaccount to an account address": { + testTransferFundToAccount: true, + asset: *constants.Usdc, + accAddressBalance: big.NewInt(2500), + subaccountModuleAccBalance: big.NewInt(600), + quantums: big.NewInt(500), + assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + perpetualPositions: []*types.PerpetualPosition{ + &constants.PerpetualPosition_OneISOLong, + }, + collateralPoolAddr: authtypes.NewModuleAddress( + types.ModuleName + ":" + lib.UintToString(constants.PerpetualPosition_OneISOLong.PerpetualId), + ), expectedQuoteBalance: big.NewInt(0), // 500 - 500 expectedSubaccountsModuleAccBalance: big.NewInt(100), // 600 - 100 expectedAccAddressBalance: big.NewInt(3000), // 500 + 2500 @@ -73,17 +97,42 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun assetPositions: keepertest.CreateUsdcAssetPosition( big.NewInt(30_000_001), ), // $3.0001 + perpetualPositions: []*types.PerpetualPosition{ + &constants.PerpetualPosition_OneBTCLong, + }, + collateralPoolAddr: types.ModuleAddress, expectedQuoteBalance: big.NewInt(10_000_001), // $1.0001, untransfered $0.0001 remains. expectedSubaccountsModuleAccBalance: big.NewInt(8_000_000), // $8 expectedAccAddressBalance: big.NewInt(4_500_000), // $2.5 + $2 }, "DepositFundsFromAccountToSubaccount: send from account to subaccount": { - testTransferFundToAccount: false, - asset: *constants.Usdc, - subaccountModuleAccBalance: big.NewInt(200), - accAddressBalance: big.NewInt(2000), - quantums: big.NewInt(500), - assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(150)), + testTransferFundToAccount: false, + asset: *constants.Usdc, + subaccountModuleAccBalance: big.NewInt(200), + accAddressBalance: big.NewInt(2000), + quantums: big.NewInt(500), + assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(150)), + perpetualPositions: []*types.PerpetualPosition{ + &constants.PerpetualPosition_OneBTCLong, + }, + collateralPoolAddr: types.ModuleAddress, + expectedQuoteBalance: big.NewInt(650), // 150 + 500 + expectedSubaccountsModuleAccBalance: big.NewInt(700), // 200 + 500 + expectedAccAddressBalance: big.NewInt(1500), // 2000 - 500 + }, + "DepositFundsFromAccountToSubaccount: send from account to isolated subaccount": { + testTransferFundToAccount: false, + asset: *constants.Usdc, + subaccountModuleAccBalance: big.NewInt(200), + accAddressBalance: big.NewInt(2000), + quantums: big.NewInt(500), + assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(150)), + perpetualPositions: []*types.PerpetualPosition{ + &constants.PerpetualPosition_OneISOLong, + }, + collateralPoolAddr: authtypes.NewModuleAddress( + types.ModuleName + ":" + lib.UintToString(constants.PerpetualPosition_OneISOLong.PerpetualId), + ), expectedQuoteBalance: big.NewInt(650), // 150 + 500 expectedSubaccountsModuleAccBalance: big.NewInt(700), // 200 + 500 expectedAccAddressBalance: big.NewInt(1500), // 2000 - 500 @@ -99,13 +148,17 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun MarketId: uint32(0), AtomicResolution: int32(-5), // $1 = 100_000 quantums }, - subaccountModuleAccBalance: big.NewInt(2_000_000), // $2 - accAddressBalance: big.NewInt(9_000_000), // $9 - quantums: big.NewInt(502_100), // $5.021 - assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(105_000)), // $1.05 - expectedQuoteBalance: big.NewInt(607_100), // $1.05 + $5.021 - expectedSubaccountsModuleAccBalance: big.NewInt(7_021_000), // $2 + $5.021 - expectedAccAddressBalance: big.NewInt(3_979_000), // $9 - $5.021 + subaccountModuleAccBalance: big.NewInt(2_000_000), // $2 + accAddressBalance: big.NewInt(9_000_000), // $9 + quantums: big.NewInt(502_100), // $5.021 + assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(105_000)), // $1.05 + perpetualPositions: []*types.PerpetualPosition{ + &constants.PerpetualPosition_OneBTCLong, + }, + collateralPoolAddr: types.ModuleAddress, + expectedQuoteBalance: big.NewInt(607_100), // $1.05 + $5.021 + expectedSubaccountsModuleAccBalance: big.NewInt(7_021_000), // $2 + $5.021 + expectedAccAddressBalance: big.NewInt(3_979_000), // $9 - $5.021 }, "DepositFundsFromAccountToSubaccount: new balance reaches max int64": { testTransferFundToAccount: false, @@ -116,6 +169,10 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun assetPositions: keepertest.CreateUsdcAssetPosition( new(big.Int).SetUint64(math.MaxUint64 - 100), ), + perpetualPositions: []*types.PerpetualPosition{ + &constants.PerpetualPosition_OneBTCLong, + }, + collateralPoolAddr: types.ModuleAddress, expectedQuoteBalance: new(big.Int).Add( new(big.Int).SetUint64(math.MaxUint64), big.NewInt(400), @@ -135,9 +192,14 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun for name, tc := range tests { t.Run(name, func(t *testing.T) { - ctx, keeper, pricesKeeper, _, accountKeeper, bankKeeper, assetsKeeper, _, _ := keepertest.SubaccountsKeepers(t, true) + ctx, keeper, pricesKeeper, perpetualsKeeper, accountKeeper, bankKeeper, assetsKeeper, _, _ := + keepertest.SubaccountsKeepers(t, true) keepertest.CreateTestMarkets(t, ctx, pricesKeeper) + keepertest.CreateTestLiquidityTiers(t, ctx, perpetualsKeeper) + + keepertest.CreateTestPerpetuals(t, ctx, perpetualsKeeper) + // Set up Subaccounts module account. auth_testutil.CreateTestModuleAccount(ctx, accountKeeper, types.ModuleName, []string{}) @@ -162,18 +224,6 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun require.NoError(t, err) } - if tc.subaccountModuleAccBalance.Sign() > 0 { - err := bank_testutil.FundModuleAccount( - ctx, - types.ModuleName, - sdk.Coins{ - sdk.NewCoin(tc.asset.Denom, sdkmath.NewIntFromBigInt(tc.subaccountModuleAccBalance)), - }, - *bankKeeper, - ) - require.NoError(t, err) - } - _, err = assetsKeeper.CreateAsset( ctx, tc.asset.Id, @@ -188,9 +238,22 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccount := createNSubaccount(keeper, ctx, 1, big.NewInt(1_000))[0] subaccount.AssetPositions = tc.assetPositions + subaccount.PerpetualPositions = tc.perpetualPositions keeper.SetSubaccount(ctx, subaccount) + if tc.subaccountModuleAccBalance.Sign() > 0 { + err := bank_testutil.FundAccount( + ctx, + tc.collateralPoolAddr, + sdk.Coins{ + sdk.NewCoin(tc.asset.Denom, sdkmath.NewIntFromBigInt(tc.subaccountModuleAccBalance)), + }, + *bankKeeper, + ) + require.NoError(t, err) + } + // Test either WithdrawFundsFromSubaccountToAccount or DepositFundsFromAccountToSubaccount. if tc.testTransferFundToAccount { err = keeper.WithdrawFundsFromSubaccountToAccount( @@ -226,7 +289,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun ) // Check the subaccount module balance. - subaccountsModuleAccBalance := bankKeeper.GetBalance(ctx, types.ModuleAddress, tc.asset.Denom) + subaccountsModuleAccBalance := bankKeeper.GetBalance(ctx, tc.collateralPoolAddr, tc.asset.Denom) require.Equal(t, sdk.NewCoin(tc.asset.Denom, sdkmath.NewIntFromBigInt(tc.expectedSubaccountsModuleAccBalance)), subaccountsModuleAccBalance, @@ -252,12 +315,15 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun asset asstypes.Asset // Subaccount state. - assetPositions []*types.AssetPosition + assetPositions []*types.AssetPosition + perpetualPositions []*types.PerpetualPosition // Module account state. subaccountModuleAccBalance *big.Int accAddressBalance *big.Int + collateralPoolAddr sdk.AccAddress + // Transfer details quantums *big.Int @@ -271,6 +337,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccountModuleAccBalance: big.NewInt(500), quantums: big.NewInt(500), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(100)), + collateralPoolAddr: types.ModuleAddress, expectedErr: types.ErrFailedToUpdateSubaccounts, }, "WithdrawFundsFromSubaccountToAccount: subaccounts module account does not have enough balance": { @@ -280,8 +347,24 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun accAddressBalance: big.NewInt(5000), quantums: big.NewInt(500), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + collateralPoolAddr: types.ModuleAddress, expectedErr: sdkerrors.ErrInsufficientFunds, }, + "WithdrawFundsFromSubaccountToAccount: isolated market subaccounts module account does not have enough balance": { + testTransferFundToAccount: true, + asset: *constants.Usdc, + subaccountModuleAccBalance: big.NewInt(400), + accAddressBalance: big.NewInt(5000), + quantums: big.NewInt(500), + assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + perpetualPositions: []*types.PerpetualPosition{ + &constants.PerpetualPosition_OneISOLong, + }, + collateralPoolAddr: authtypes.NewModuleAddress( + types.ModuleName + ":" + lib.UintToString(constants.PerpetualPosition_OneISOLong.PerpetualId), + ), + expectedErr: sdkerrors.ErrInsufficientFunds, + }, "WithdrawFundsFromSubaccountToAccount: transfer quantums is zero": { testTransferFundToAccount: true, asset: *constants.Usdc, @@ -289,6 +372,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccountModuleAccBalance: big.NewInt(600), quantums: big.NewInt(0), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + collateralPoolAddr: types.ModuleAddress, expectedErr: types.ErrAssetTransferQuantumsNotPositive, }, "WithdrawFundsFromSubaccountToAccount: transfer quantums is negative": { @@ -298,6 +382,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccountModuleAccBalance: big.NewInt(600), quantums: big.NewInt(-100), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + collateralPoolAddr: types.ModuleAddress, expectedErr: types.ErrAssetTransferQuantumsNotPositive, }, "WithdrawFundsFromSubaccountToAccount: do not support assets other than USDC": { @@ -307,6 +392,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccountModuleAccBalance: big.NewInt(500), quantums: big.NewInt(500), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + collateralPoolAddr: types.ModuleAddress, expectedErr: types.ErrAssetTransferThroughBankNotImplemented, }, "WithdrawFundsFromSubaccountToAccount: asset ID doesn't exist": { @@ -317,6 +403,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccountModuleAccBalance: big.NewInt(500), quantums: big.NewInt(500), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + collateralPoolAddr: types.ModuleAddress, expectedErr: asstypes.ErrAssetDoesNotExist, }, "DepositFundsFromAccountToSubaccount: fee-collector does not have enough balance to transfer": { @@ -326,6 +413,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccountModuleAccBalance: big.NewInt(2000), quantums: big.NewInt(500), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + collateralPoolAddr: types.ModuleAddress, expectedErr: sdkerrors.ErrInsufficientFunds, }, "DepositFundsFromAccountToSubaccount: transfer quantums is zero": { @@ -335,6 +423,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccountModuleAccBalance: big.NewInt(600), quantums: big.NewInt(0), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + collateralPoolAddr: types.ModuleAddress, expectedErr: types.ErrAssetTransferQuantumsNotPositive, }, "DepositFundsFromAccountToSubaccount: do not support assets other than USDC": { @@ -344,6 +433,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccountModuleAccBalance: big.NewInt(500), quantums: big.NewInt(500), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + collateralPoolAddr: types.ModuleAddress, expectedErr: types.ErrAssetTransferThroughBankNotImplemented, }, "DepositFundsFromAccountToSubaccount: failure, asset ID doesn't exist": { @@ -354,6 +444,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccountModuleAccBalance: big.NewInt(500), quantums: big.NewInt(500), assetPositions: keepertest.CreateUsdcAssetPosition(big.NewInt(500)), + collateralPoolAddr: types.ModuleAddress, expectedErr: asstypes.ErrAssetDoesNotExist, }, // TODO(DEC-715): Add more test for non-USDC assets, after asset update @@ -362,8 +453,12 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun for name, tc := range tests { t.Run(name, func(t *testing.T) { - ctx, keeper, pricesKeeper, _, accountKeeper, bankKeeper, assetsKeeper, _, _ := keepertest.SubaccountsKeepers(t, true) + ctx, keeper, pricesKeeper, perpetualsKeeper, accountKeeper, bankKeeper, assetsKeeper, _, _ := + keepertest.SubaccountsKeepers(t, true) keepertest.CreateTestMarkets(t, ctx, pricesKeeper) + keepertest.CreateTestLiquidityTiers(t, ctx, perpetualsKeeper) + + keepertest.CreateTestPerpetuals(t, ctx, perpetualsKeeper) // Set up Subaccounts module account. auth_testutil.CreateTestModuleAccount(ctx, accountKeeper, types.ModuleName, []string{}) @@ -389,18 +484,6 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun require.NoError(t, err) } - if tc.subaccountModuleAccBalance.Sign() > 0 { - err := bank_testutil.FundModuleAccount( - ctx, - types.ModuleName, - sdk.Coins{ - sdk.NewCoin(tc.asset.Denom, sdkmath.NewIntFromBigInt(tc.subaccountModuleAccBalance)), - }, - *bankKeeper, - ) - require.NoError(t, err) - } - if !tc.skipSetUpUsdc { // Always create USDC as the first asset unless specificed to skip. err := keepertest.CreateUsdcAsset(ctx, assetsKeeper) @@ -423,9 +506,22 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun subaccount := createNSubaccount(keeper, ctx, 1, big.NewInt(1_000))[0] subaccount.AssetPositions = tc.assetPositions + subaccount.PerpetualPositions = tc.perpetualPositions keeper.SetSubaccount(ctx, subaccount) + if tc.subaccountModuleAccBalance.Sign() > 0 { + err := bank_testutil.FundAccount( + ctx, + tc.collateralPoolAddr, + sdk.Coins{ + sdk.NewCoin(tc.asset.Denom, sdkmath.NewIntFromBigInt(tc.subaccountModuleAccBalance)), + }, + *bankKeeper, + ) + require.NoError(t, err) + } + // Test either WithdrawFundsFromSubaccountToAccount or DepositFundsFromAccountToSubaccount. if tc.testTransferFundToAccount { err = keeper.WithdrawFundsFromSubaccountToAccount( @@ -459,7 +555,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun ) // Check the subaccount module balance stays the same. - subaccountsModuleAccBalance := bankKeeper.GetBalance(ctx, types.ModuleAddress, tc.asset.Denom) + subaccountsModuleAccBalance := bankKeeper.GetBalance(ctx, tc.collateralPoolAddr, tc.asset.Denom) require.Equal(t, sdk.NewCoin(tc.asset.Denom, sdkmath.NewIntFromBigInt(tc.subaccountModuleAccBalance)), subaccountsModuleAccBalance, @@ -487,8 +583,11 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { feeModuleAccBalance *big.Int // Transfer details. - asset asstypes.Asset - quantums *big.Int + asset asstypes.Asset + quantums *big.Int + perpetualId uint32 + + collateralPoolAddr sdk.AccAddress // Expectations. expectedErr error @@ -500,6 +599,19 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { feeModuleAccBalance: big.NewInt(2500), subaccountModuleAccBalance: big.NewInt(600), quantums: big.NewInt(500), + collateralPoolAddr: types.ModuleAddress, + expectedSubaccountsModuleAccBalance: big.NewInt(100), // 600 - 500 + expectedFeeModuleAccBalance: big.NewInt(3000), // 500 + 2500 + }, + "success - send to fee-collector module account from isolated market account": { + asset: *constants.Usdc, + feeModuleAccBalance: big.NewInt(2500), + subaccountModuleAccBalance: big.NewInt(600), + quantums: big.NewInt(500), + perpetualId: 3, // Isolated market perpetual ID + collateralPoolAddr: authtypes.NewModuleAddress( + types.ModuleName + ":" + lib.IntToString(3), + ), expectedSubaccountsModuleAccBalance: big.NewInt(100), // 600 - 500 expectedFeeModuleAccBalance: big.NewInt(3000), // 500 + 2500 }, @@ -508,6 +620,7 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { feeModuleAccBalance: big.NewInt(2500), subaccountModuleAccBalance: big.NewInt(600), quantums: big.NewInt(0), + collateralPoolAddr: types.ModuleAddress, expectedSubaccountsModuleAccBalance: big.NewInt(600), // 600 expectedFeeModuleAccBalance: big.NewInt(2500), // 2500 }, @@ -516,6 +629,20 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { feeModuleAccBalance: big.NewInt(2500), subaccountModuleAccBalance: big.NewInt(300), quantums: big.NewInt(500), + collateralPoolAddr: types.ModuleAddress, + expectedSubaccountsModuleAccBalance: big.NewInt(300), + expectedFeeModuleAccBalance: big.NewInt(2500), + expectedErr: sdkerrors.ErrInsufficientFunds, + }, + "failure - isolated markets subaccounts module does not have sufficient funds": { + asset: *constants.Usdc, + feeModuleAccBalance: big.NewInt(2500), + subaccountModuleAccBalance: big.NewInt(300), + quantums: big.NewInt(500), + perpetualId: 3, // Isolated market perpetual ID + collateralPoolAddr: authtypes.NewModuleAddress( + types.ModuleName + ":" + lib.IntToString(3), + ), expectedSubaccountsModuleAccBalance: big.NewInt(300), expectedFeeModuleAccBalance: big.NewInt(2500), expectedErr: sdkerrors.ErrInsufficientFunds, @@ -526,6 +653,7 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { asset: *constants.Usdc, subaccountModuleAccBalance: big.NewInt(500), quantums: big.NewInt(500), + collateralPoolAddr: types.ModuleAddress, expectedErr: asstypes.ErrAssetDoesNotExist, expectedSubaccountsModuleAccBalance: big.NewInt(500), expectedFeeModuleAccBalance: big.NewInt(1500), @@ -535,6 +663,7 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { asset: *constants.BtcUsd, subaccountModuleAccBalance: big.NewInt(500), quantums: big.NewInt(500), + collateralPoolAddr: types.ModuleAddress, expectedErr: types.ErrAssetTransferThroughBankNotImplemented, expectedSubaccountsModuleAccBalance: big.NewInt(500), expectedFeeModuleAccBalance: big.NewInt(1500), @@ -544,6 +673,7 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { asset: *constants.Usdc, subaccountModuleAccBalance: big.NewInt(500), quantums: big.NewInt(-500), + collateralPoolAddr: types.ModuleAddress, expectedSubaccountsModuleAccBalance: big.NewInt(1000), expectedFeeModuleAccBalance: big.NewInt(1000), }, @@ -553,9 +683,11 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { for name, tc := range tests { t.Run(name, func(t *testing.T) { - ctx, keeper, pricesKeeper, _, accountKeeper, bankKeeper, assetsKeeper, _, _ := keepertest.SubaccountsKeepers(t, true) + ctx, keeper, pricesKeeper, perpetualsKeeper, accountKeeper, bankKeeper, assetsKeeper, _, _ := + keepertest.SubaccountsKeepers(t, true) keepertest.CreateTestMarkets(t, ctx, pricesKeeper) - + keepertest.CreateTestLiquidityTiers(t, ctx, perpetualsKeeper) + keepertest.CreateTestPerpetuals(t, ctx, perpetualsKeeper) // Set up Subaccounts module account. auth_testutil.CreateTestModuleAccount(ctx, accountKeeper, types.ModuleName, []string{}) // Set up receiver module account. @@ -589,9 +721,9 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { } if tc.subaccountModuleAccBalance.Sign() > 0 { - err := bank_testutil.FundModuleAccount( + err := bank_testutil.FundAccount( ctx, - types.ModuleName, + tc.collateralPoolAddr, sdk.Coins{ sdk.NewCoin(tc.asset.Denom, sdkmath.NewIntFromBigInt(tc.subaccountModuleAccBalance)), }, @@ -620,11 +752,7 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { require.NoError(t, err) } - err := keeper.TransferFeesToFeeCollectorModule( - ctx, - tc.asset.Id, - tc.quantums, - ) + err := keeper.TransferFeesToFeeCollectorModule(ctx, tc.asset.Id, tc.quantums, tc.perpetualId) if tc.expectedErr != nil { require.ErrorIs(t, @@ -636,7 +764,7 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) { } // Check the subaccount module balance. - subaccountsModuleAccBalance := bankKeeper.GetBalance(ctx, types.ModuleAddress, tc.asset.Denom) + subaccountsModuleAccBalance := bankKeeper.GetBalance(ctx, tc.collateralPoolAddr, tc.asset.Denom) require.Equal(t, sdk.NewCoin(tc.asset.Denom, sdkmath.NewIntFromBigInt(tc.expectedSubaccountsModuleAccBalance)), subaccountsModuleAccBalance, @@ -663,6 +791,7 @@ func TestTransferInsuranceFundPayments(t *testing.T) { subaccountModuleAccBalance int64 insuranceFundBalance int64 perpetual perptypes.Perpetual + collateralPoolAddr sdk.AccAddress // Transfer details. quantums *big.Int @@ -678,6 +807,7 @@ func TestTransferInsuranceFundPayments(t *testing.T) { insuranceFundBalance: 2500, subaccountModuleAccBalance: 600, quantums: big.NewInt(500), + collateralPoolAddr: types.ModuleAddress, expectedSubaccountsModuleAccBalance: 100, // 600 - 500 expectedInsuranceFundBalance: 3000, // 2500 + 500 }, @@ -686,6 +816,7 @@ func TestTransferInsuranceFundPayments(t *testing.T) { insuranceFundBalance: 2500, subaccountModuleAccBalance: 600, quantums: big.NewInt(-500), + collateralPoolAddr: types.ModuleAddress, expectedSubaccountsModuleAccBalance: 1100, // 600 + 500 expectedInsuranceFundBalance: 2000, // 2500 - 500 }, @@ -694,22 +825,29 @@ func TestTransferInsuranceFundPayments(t *testing.T) { insuranceFundBalance: 2500, subaccountModuleAccBalance: 600, quantums: big.NewInt(0), + collateralPoolAddr: types.ModuleAddress, expectedSubaccountsModuleAccBalance: 600, expectedInsuranceFundBalance: 2500, }, "success - send to isolated insurance fund account": { - perpetual: constants.IsoUsd_IsolatedMarket, - insuranceFundBalance: 2500, - subaccountModuleAccBalance: 600, - quantums: big.NewInt(500), + perpetual: constants.IsoUsd_IsolatedMarket, + insuranceFundBalance: 2500, + subaccountModuleAccBalance: 600, + quantums: big.NewInt(500), + collateralPoolAddr: authtypes.NewModuleAddress( + types.ModuleName + ":" + lib.UintToString(constants.IsoUsd_IsolatedMarket.GetId()), + ), expectedSubaccountsModuleAccBalance: 100, // 600 - 500 expectedInsuranceFundBalance: 3000, // 2500 + 500 }, "success - send from isolated insurance fund account": { - perpetual: constants.IsoUsd_IsolatedMarket, - insuranceFundBalance: 2500, - subaccountModuleAccBalance: 600, - quantums: big.NewInt(-500), + perpetual: constants.IsoUsd_IsolatedMarket, + insuranceFundBalance: 2500, + subaccountModuleAccBalance: 600, + quantums: big.NewInt(-500), + collateralPoolAddr: authtypes.NewModuleAddress( + types.ModuleName + ":" + lib.UintToString(constants.IsoUsd_IsolatedMarket.GetId()), + ), expectedSubaccountsModuleAccBalance: 1100, // 600 + 500 expectedInsuranceFundBalance: 2000, // 2500 - 500 }, @@ -718,6 +856,7 @@ func TestTransferInsuranceFundPayments(t *testing.T) { insuranceFundBalance: 2500, subaccountModuleAccBalance: 300, quantums: big.NewInt(500), + collateralPoolAddr: types.ModuleAddress, expectedSubaccountsModuleAccBalance: 300, expectedInsuranceFundBalance: 2500, expectedErr: sdkerrors.ErrInsufficientFunds, @@ -727,6 +866,7 @@ func TestTransferInsuranceFundPayments(t *testing.T) { insuranceFundBalance: 300, subaccountModuleAccBalance: 2500, quantums: big.NewInt(-500), + collateralPoolAddr: types.ModuleAddress, expectedSubaccountsModuleAccBalance: 2500, expectedInsuranceFundBalance: 300, expectedErr: sdkerrors.ErrInsufficientFunds, @@ -746,6 +886,7 @@ func TestTransferInsuranceFundPayments(t *testing.T) { skipSetUpUsdc: true, subaccountModuleAccBalance: 500, quantums: big.NewInt(500), + collateralPoolAddr: types.ModuleAddress, expectedErr: errorsmod.Wrap(asstypes.ErrAssetDoesNotExist, lib.UintToString(uint32(0))), expectedSubaccountsModuleAccBalance: 500, expectedInsuranceFundBalance: 1500, @@ -790,14 +931,14 @@ func TestTransferInsuranceFundPayments(t *testing.T) { ) require.NoError(t, err) - insuranceFundName, err := perpsKeeper.GetInsuranceFundName(ctx, tc.perpetual.GetId()) + insuranceFundAddr, err := perpsKeeper.GetInsuranceFundModuleAddress(ctx, tc.perpetual.GetId()) require.NoError(t, err) // Mint asset in the receipt/sender module account for transfer. if tc.insuranceFundBalance > 0 { err := bank_testutil.FundAccount( ctx, - authtypes.NewModuleAddress(insuranceFundName), + insuranceFundAddr, sdk.Coins{ sdk.NewInt64Coin(constants.Usdc.Denom, tc.insuranceFundBalance), }, @@ -807,9 +948,9 @@ func TestTransferInsuranceFundPayments(t *testing.T) { } if tc.subaccountModuleAccBalance > 0 { - err := bank_testutil.FundModuleAccount( + err := bank_testutil.FundAccount( ctx, - types.ModuleName, + tc.collateralPoolAddr, sdk.Coins{ sdk.NewInt64Coin(constants.Usdc.Denom, tc.subaccountModuleAccBalance), }, @@ -845,7 +986,7 @@ func TestTransferInsuranceFundPayments(t *testing.T) { } // Check the subaccount module balance. - subaccountsModuleAccBalance := bankKeeper.GetBalance(ctx, types.ModuleAddress, constants.Usdc.Denom) + subaccountsModuleAccBalance := bankKeeper.GetBalance(ctx, tc.collateralPoolAddr, constants.Usdc.Denom) require.Equal( t, sdk.NewInt64Coin(constants.Usdc.Denom, tc.expectedSubaccountsModuleAccBalance), @@ -854,7 +995,7 @@ func TestTransferInsuranceFundPayments(t *testing.T) { // Check the fee module account balance has been updated as expected. toModuleBalance := bankKeeper.GetBalance( - ctx, authtypes.NewModuleAddress(insuranceFundName), + ctx, insuranceFundAddr, constants.Usdc.Denom, ) require.Equal(t, diff --git a/protocol/x/subaccounts/types/expected_keepers.go b/protocol/x/subaccounts/types/expected_keepers.go index 40a21e203d..4d30eb8174 100644 --- a/protocol/x/subaccounts/types/expected_keepers.go +++ b/protocol/x/subaccounts/types/expected_keepers.go @@ -73,6 +73,7 @@ type PerpetualsKeeper interface { ) GetAllPerpetuals(ctx sdk.Context) []perptypes.Perpetual GetInsuranceFundName(ctx sdk.Context, perpetualId uint32) (string, error) + GetInsuranceFundModuleAddress(ctx sdk.Context, perpetualId uint32) (sdk.AccAddress, error) } // BankKeeper defines the expected interface needed to retrieve account balances.