-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IND-399] Improve comments, remove SQL function that wasn't being use…
…d, fix some stylistic choices in case statements.
- Loading branch information
Showing
32 changed files
with
114 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
indexer/services/ender/src/scripts/dydx_clob_pair_status_to_market_status.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
indexer/services/ender/src/scripts/dydx_event_to_transaction_index.sql
This file was deleted.
Oops, something went wrong.
8 changes: 3 additions & 5 deletions
8
indexer/services/ender/src/scripts/dydx_from_protocol_order_side.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
/** | ||
Converts the 'Side' enum from the IndexerOrder protobuf (https://github.com/dydxprotocol/v4-proto/blob/437f6d8/dydxprotocol/indexer/protocol/v1/clob.proto#L56) | ||
Converts the 'Side' enum from the IndexerOrder protobuf (https://github.com/dydxprotocol/v4-chain/blob/9ed26bd/proto/dydxprotocol/indexer/protocol/v1/clob.proto#L56) | ||
to the 'OrderSide' enum in postgres. | ||
*/ | ||
CREATE OR REPLACE FUNCTION dydx_from_protocol_order_side(order_side jsonb) RETURNS text AS $$ | ||
BEGIN | ||
CASE order_side | ||
WHEN '1'::jsonb THEN | ||
RETURN 'BUY'; | ||
ELSE | ||
RETURN 'SELL'; | ||
WHEN '1'::jsonb THEN RETURN 'BUY'; /** SIDE_BUY */ | ||
ELSE RETURN 'SELL'; | ||
END CASE; | ||
END; | ||
$$ LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; |
16 changes: 7 additions & 9 deletions
16
indexer/services/ender/src/scripts/dydx_from_protocol_time_in_force.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
/** | ||
Converts the TimeInForce field from an IndexerOrder proto (https://github.com/dydxprotocol/v4-proto/blob/437f6d8/dydxprotocol/indexer/protocol/v1/clob.proto#L95) | ||
Converts the TimeInForce field from an IndexerOrder proto (https://github.com/dydxprotocol/v4-chain/blob/9ed26bd/proto/dydxprotocol/indexer/protocol/v1/clob.proto#L94) | ||
to a TimeInForce enum in postgres. | ||
Raise an exception if the input TimeInForce enum is not in the known enum values for TimeInForce. | ||
*/ | ||
CREATE OR REPLACE FUNCTION dydx_from_protocol_time_in_force(tif jsonb) RETURNS text AS $$ | ||
BEGIN | ||
CASE tif | ||
-- Default behavior with UNRECOGNIZED = GTT (Good-Til-Time) | ||
WHEN '-1'::jsonb THEN RETURN 'GTT'; | ||
-- Default behavior with TIME_IN_FORCE_UNSPECIFIED = GTT (Good-Til-Time) | ||
WHEN '0'::jsonb THEN RETURN 'GTT'; | ||
WHEN '1'::jsonb THEN RETURN 'IOC'; | ||
WHEN '2'::jsonb THEN RETURN 'POST_ONLY'; | ||
WHEN '3'::jsonb THEN RETURN 'FOK'; | ||
WHEN '-1'::jsonb THEN RETURN 'GTT'; /** Default behavior with UNRECOGNIZED = GTT (Good-Til-Time) */ | ||
WHEN '0'::jsonb THEN RETURN 'GTT'; /** Default behavior with TIME_IN_FORCE_UNSPECIFIED = GTT (Good-Til-Time) */ | ||
WHEN '1'::jsonb THEN RETURN 'IOC'; /** TIME_IN_FORCE_IOC */ | ||
WHEN '2'::jsonb THEN RETURN 'POST_ONLY'; /** TIME_IN_FORCE_POST_ONLY */ | ||
WHEN '3'::jsonb THEN RETURN 'FOK'; /** TIME_IN_FORCE_FILL_OR_KILL */ | ||
ELSE RAISE EXCEPTION 'Unexpected TimeInForce from protocol %', tif; | ||
END CASE; | ||
END CASE; | ||
END; | ||
$$ LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; |
4 changes: 2 additions & 2 deletions
4
indexer/services/ender/src/scripts/dydx_from_serializable_int.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 23 additions & 16 deletions
39
indexer/services/ender/src/scripts/dydx_get_order_status.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
indexer/services/ender/src/scripts/dydx_get_weighted_average.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.