Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

FNS subaccount implementation #2059

Merged
merged 45 commits into from
Aug 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bda8ec4
first
dydxwill Jul 30, 2024
af1eb90
test
dydxwill Jul 30, 2024
2c10c1d
test
dydxwill Aug 2, 2024
20e627f
revert
dydxwill Aug 2, 2024
0dd93fd
merge
dydxwill Aug 2, 2024
cd6572a
update proto
dydxwill Aug 2, 2024
dc2bc8e
lint
dydxwill Aug 2, 2024
3c7a63b
rm global cache
dydxwill Aug 5, 2024
af79f20
dev5
dydxwill Aug 5, 2024
96cb022
add branch
dydxwill Aug 5, 2024
57e54fa
dev2
dydxwill Aug 6, 2024
ce15619
lint
dydxwill Aug 6, 2024
e6fcbf5
revert ghwf
dydxwill Aug 6, 2024
1357239
fix
dydxwill Aug 6, 2024
2816d5f
merge
dydxwill Aug 6, 2024
7d08ac2
add indexer proto
dydxwill Aug 6, 2024
8d333b8
address cmts
dydxwill Aug 6, 2024
390b118
add cmts
dydxwill Aug 6, 2024
fd7abb0
Merge branch 'wl/sa_updates' of https://github.com/dydxprotocol/v4-ch…
dydxwill Aug 6, 2024
318e9ac
t
dydxwill Aug 6, 2024
71c0f08
latest
dydxwill Aug 6, 2024
f03735d
merge
dydxwill Aug 6, 2024
1ab0669
add su update
dydxwill Aug 6, 2024
079ffd5
add snapshotting logic
dydxwill Aug 6, 2024
3d5db4e
updates
dydxwill Aug 6, 2024
ee5e8f7
set Snapshot to true
dydxwill Aug 6, 2024
71cbe99
merge
dydxwill Aug 7, 2024
0a6bd3a
add back todo
dydxwill Aug 7, 2024
cd7472c
add gh wf
dydxwill Aug 7, 2024
ef9a0ec
add logs
dydxwill Aug 7, 2024
e4f254b
latest
dydxwill Aug 7, 2024
3c024b0
add log
dydxwill Aug 7, 2024
10e4512
fix
dydxwill Aug 7, 2024
d555b9d
rm logs
dydxwill Aug 7, 2024
49a8dcc
fix cmt
dydxwill Aug 7, 2024
8d97bda
fix event
dydxwill Aug 7, 2024
e6a5be0
Merge branch 'main' of https://github.com/dydxprotocol/v4-chain into …
dydxwill Aug 8, 2024
898074b
gh wf
dydxwill Aug 8, 2024
b9fbbeb
tmp merge
dydxwill Aug 9, 2024
1fba8ca
merge fix
dydxwill Aug 9, 2024
84b2f05
add back cmt
dydxwill Aug 9, 2024
53bb1be
address cmts
dydxwill Aug 12, 2024
320b3b0
address cmts
dydxwill Aug 12, 2024
edd63c7
Merge branch 'main' of https://github.com/dydxprotocol/v4-chain into …
dydxwill Aug 12, 2024
65b28cc
gh wf
dydxwill Aug 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updates
dydxwill committed Aug 6, 2024
commit 3d5db4ecf10ddfe92384997928455c6d110a146a
283 changes: 0 additions & 283 deletions indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts
Original file line number Diff line number Diff line change
@@ -321,104 +321,6 @@ export interface StreamUpdateSDKType {

exec_mode: number;
}
/**
* SubaccountPerpetualPosition provides information on a subaccount's updated
* perpetual positions.
*/

export interface SubaccountPerpetualPosition {
/** The `Id` of the `Perpetual`. */
perpetualId: number;
/** The size of the position in base quantums. */

quantums: Long;
}
/**
* SubaccountPerpetualPosition provides information on a subaccount's updated
* perpetual positions.
*/

export interface SubaccountPerpetualPositionSDKType {
/** The `Id` of the `Perpetual`. */
perpetual_id: number;
/** The size of the position in base quantums. */

quantums: Long;
}
/**
* SubaccountAssetPosition provides information on a subaccount's updated asset
* positions.
*/

export interface SubaccountAssetPosition {
/** The `Id` of the `Asset`. */
assetId: number;
/** The absolute size of the position in base quantums. */

quantums: Long;
}
/**
* SubaccountAssetPosition provides information on a subaccount's updated asset
* positions.
*/

export interface SubaccountAssetPositionSDKType {
/** The `Id` of the `Asset`. */
asset_id: number;
/** The absolute size of the position in base quantums. */

quantums: Long;
}
/**
* StreamSubaccountUpdate provides information on a subaccount update. Used in
* the full node GRPC stream.
*/

export interface StreamSubaccountUpdate {
subaccountId?: SubaccountId;
/** updated_perpetual_positions will each be for unique perpetuals. */

updatedPerpetualPositions: SubaccountPerpetualPosition[];
/** updated_asset_positions will each be for unique assets. */

updatedAssetPositions: SubaccountAssetPosition[];
/**
* Snapshot indicates if the response is from a snapshot of the subaccount.
* All updates should be ignored until snapshot is received.
* If the snapshot is true, then all previous entries should be
* discarded and the subaccount should be resynced.
* For a snapshot subaccount update, the `updated_perpetual_positions` and
* `updated_asset_positions` fields will contain the full state of the
* subaccount.
*/

snapshot: boolean;
}
/**
* StreamSubaccountUpdate provides information on a subaccount update. Used in
* the full node GRPC stream.
*/

export interface StreamSubaccountUpdateSDKType {
subaccount_id?: SubaccountIdSDKType;
/** updated_perpetual_positions will each be for unique perpetuals. */

updated_perpetual_positions: SubaccountPerpetualPositionSDKType[];
/** updated_asset_positions will each be for unique assets. */

updated_asset_positions: SubaccountAssetPositionSDKType[];
/**
* Snapshot indicates if the response is from a snapshot of the subaccount.
* All updates should be ignored until snapshot is received.
* If the snapshot is true, then all previous entries should be
* discarded and the subaccount should be resynced.
* For a snapshot subaccount update, the `updated_perpetual_positions` and
* `updated_asset_positions` fields will contain the full state of the
* subaccount.
*/

snapshot: boolean;
}
/**
* StreamOrderbookUpdate provides information on an orderbook update. Used in
* the full node GRPC stream.
@@ -1496,191 +1398,6 @@ export const StreamUpdate = {

};

function createBaseSubaccountPerpetualPosition(): SubaccountPerpetualPosition {
return {
perpetualId: 0,
quantums: Long.UZERO
};
}

export const SubaccountPerpetualPosition = {
encode(message: SubaccountPerpetualPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.perpetualId !== 0) {
writer.uint32(8).uint32(message.perpetualId);
}

if (!message.quantums.isZero()) {
writer.uint32(16).uint64(message.quantums);
}

return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountPerpetualPosition {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSubaccountPerpetualPosition();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
case 1:
message.perpetualId = reader.uint32();
break;

case 2:
message.quantums = (reader.uint64() as Long);
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(object: DeepPartial<SubaccountPerpetualPosition>): SubaccountPerpetualPosition {
const message = createBaseSubaccountPerpetualPosition();
message.perpetualId = object.perpetualId ?? 0;
message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO;
return message;
}

};

function createBaseSubaccountAssetPosition(): SubaccountAssetPosition {
return {
assetId: 0,
quantums: Long.UZERO
};
}

export const SubaccountAssetPosition = {
encode(message: SubaccountAssetPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.assetId !== 0) {
writer.uint32(8).uint32(message.assetId);
}

if (!message.quantums.isZero()) {
writer.uint32(16).uint64(message.quantums);
}

return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountAssetPosition {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSubaccountAssetPosition();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
case 1:
message.assetId = reader.uint32();
break;

case 2:
message.quantums = (reader.uint64() as Long);
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(object: DeepPartial<SubaccountAssetPosition>): SubaccountAssetPosition {
const message = createBaseSubaccountAssetPosition();
message.assetId = object.assetId ?? 0;
message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO;
return message;
}

};

function createBaseStreamSubaccountUpdate(): StreamSubaccountUpdate {
return {
subaccountId: undefined,
updatedPerpetualPositions: [],
updatedAssetPositions: [],
snapshot: false
};
}

export const StreamSubaccountUpdate = {
encode(message: StreamSubaccountUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.subaccountId !== undefined) {
SubaccountId.encode(message.subaccountId, writer.uint32(10).fork()).ldelim();
}

for (const v of message.updatedPerpetualPositions) {
SubaccountPerpetualPosition.encode(v!, writer.uint32(18).fork()).ldelim();
}

for (const v of message.updatedAssetPositions) {
SubaccountAssetPosition.encode(v!, writer.uint32(26).fork()).ldelim();
}

if (message.snapshot === true) {
writer.uint32(32).bool(message.snapshot);
}

return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): StreamSubaccountUpdate {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseStreamSubaccountUpdate();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
case 1:
message.subaccountId = SubaccountId.decode(reader, reader.uint32());
break;

case 2:
message.updatedPerpetualPositions.push(SubaccountPerpetualPosition.decode(reader, reader.uint32()));
break;

case 3:
message.updatedAssetPositions.push(SubaccountAssetPosition.decode(reader, reader.uint32()));
break;

case 4:
message.snapshot = reader.bool();
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(object: DeepPartial<StreamSubaccountUpdate>): StreamSubaccountUpdate {
const message = createBaseStreamSubaccountUpdate();
message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined;
message.updatedPerpetualPositions = object.updatedPerpetualPositions?.map(e => SubaccountPerpetualPosition.fromPartial(e)) || [];
message.updatedAssetPositions = object.updatedAssetPositions?.map(e => SubaccountAssetPosition.fromPartial(e)) || [];
message.snapshot = object.snapshot ?? false;
return message;
}

};

function createBaseStreamOrderbookUpdate(): StreamOrderbookUpdate {
return {
updates: [],