Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/user-org-domain
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacook committed Feb 12, 2025
2 parents 22fce19 + 04d8e53 commit 1afa8fc
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 78 deletions.
1 change: 0 additions & 1 deletion src/domain/swaps/entities/__tests__/order.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export function orderBuilder(): IBuilder<Order> {
}
: null,
)
.with('executedSurplusFee', executedFee)
.with('executedFee', executedFee)
// TODO: still tbd by CoW but this will be expressed in SURPLUS tokens
// (BUY tokens for SELL orders and SELL tokens for BUY orders)
Expand Down
1 change: 0 additions & 1 deletion src/domain/swaps/entities/order.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const OrderSchema = z.object({
})
.nullish()
.default(null),
executedSurplusFee: z.coerce.bigint(),
executedFee: z.coerce.bigint(),
executedFeeToken: AddressSchema,
fullAppData: FullAppDataSchema.shape.fullAppData,
Expand Down
2 changes: 0 additions & 2 deletions src/domain/swaps/swaps.repository.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const orderIds = {
executedFeeAmount: BigInt('0'),
executedSellAmount: BigInt('20000000000000000000000'),
executedSellAmountBeforeFees: BigInt('20000000000000000000000'),
executedSurplusFee: BigInt('344394908543621220441'),
executedFee: BigInt('344394908543621220441'),
executedFeeToken: '0x710287D1D39DCf62094A83EBB3e736e79400068a',
feeAmount: BigInt('0'),
Expand Down Expand Up @@ -74,7 +73,6 @@ const orderIds = {
executedFeeAmount: BigInt('0'),
executedSellAmount: BigInt('60000000000000000000'),
executedSellAmountBeforeFees: BigInt('60000000000000000000'),
executedSurplusFee: BigInt('746134584595989'),
executedFee: BigInt('746134584595989'),
executedFeeToken: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
feeAmount: BigInt('0'),
Expand Down
8 changes: 3 additions & 5 deletions src/domain/users/entities/user.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@ import { z } from 'zod';
import { RowSchema } from '@/datasources/db/v2/entities/row.entity';
import { WalletSchema } from '@/domain/wallets/entities/wallet.entity';
import { UserOrganizationSchema } from '@/domain/users/entities/user-organization.entity';
import { getStringEnumKeys } from '@/domain/common/utils/enum';
import type { Wallet } from '@/domain/wallets/entities/wallet.entity';
import type { UserOrganization } from '@/domain/users/entities/user-organization.entity';

export enum UserStatus {
PENDING = 0,
ACTIVE = 1,
}
export const UserStatusKeys = Object.keys(UserStatus) as [
keyof typeof UserStatus,
];

export type User = z.infer<typeof UserSchema>;

// We need explicitly define ZodType due to recursion
export const UserSchema: z.ZodType<
z.infer<typeof RowSchema> & {
status: (typeof UserStatusKeys)[number];
status: keyof typeof UserStatus;
wallets: Array<Wallet>;
userOrganizations: Array<UserOrganization>;
}
> = RowSchema.extend({
status: z.enum(UserStatusKeys),
status: z.enum(getStringEnumKeys(UserStatus)),
wallets: z.array(WalletSchema),
userOrganizations: z.array(z.lazy(() => UserOrganizationSchema)),
});
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ describe('Preview transaction - CoW Swap - Transactions Controller (Unit)', () =
executedSellAmount: order.executedSellAmount.toString(),
executedBuyAmount: order.executedBuyAmount.toString(),
explorerUrl: `${swapsExplorerUrl}orders/${order.uid}`,
executedSurplusFee: order.executedSurplusFee.toString(),
executedFee: order.executedFee.toString(),
executedFeeToken: {
address: sellToken.address,
Expand Down Expand Up @@ -329,7 +328,6 @@ describe('Preview transaction - CoW Swap - Transactions Controller (Unit)', () =
executedSellAmount: order.executedSellAmount.toString(),
executedBuyAmount: order.executedBuyAmount.toString(),
explorerUrl: `${swapsExplorerUrl}orders/${order.uid}`,
executedSurplusFee: order.executedSurplusFee.toString(),
executedFee: order.executedFee.toString(),
executedFeeToken: {
address: sellToken.address,
Expand Down Expand Up @@ -754,7 +752,6 @@ describe('Preview transaction - CoW Swap - Transactions Controller (Unit)', () =
buyAmount: '1222579021996502268',
executedSellAmount: '0',
executedBuyAmount: '0',
executedSurplusFee: '0',
executedFee: '0',
executedFeeToken: {
address: sellToken.address,
Expand Down Expand Up @@ -899,7 +896,6 @@ describe('Preview transaction - CoW Swap - Transactions Controller (Unit)', () =
buyAmount: '1222579021996502268',
executedSellAmount: '0',
executedBuyAmount: '0',
executedSurplusFee: '0',
executedFee: '0',
executedFeeToken: {
address: sellToken.address,
Expand Down
10 changes: 0 additions & 10 deletions src/routes/transactions/entities/swaps/swap-order-info.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export interface OrderInfo {
executedSellAmount: string;
executedBuyAmount: string;
explorerUrl: string;
executedSurplusFee: string;
executedFee: string;
executedFeeToken: TokenInfo;
receiver: string | null;
Expand Down Expand Up @@ -92,13 +91,6 @@ export class SwapOrderTransactionInfo
})
explorerUrl: string;

@ApiProperty({
type: String,
description: 'The amount of fees paid for this order.',
deprecated: true,
})
executedSurplusFee: string;

@ApiProperty({
type: String,
description: 'The amount of fees paid for this order.',
Expand Down Expand Up @@ -144,7 +136,6 @@ export class SwapOrderTransactionInfo
sellToken: TokenInfo;
buyToken: TokenInfo;
explorerUrl: string;
executedSurplusFee: string;
executedFee: string;
executedFeeToken: TokenInfo;
receiver: string | null;
Expand All @@ -164,7 +155,6 @@ export class SwapOrderTransactionInfo
this.sellToken = args.sellToken;
this.buyToken = args.buyToken;
this.explorerUrl = args.explorerUrl;
this.executedSurplusFee = args.executedSurplusFee;
this.executedFee = args.executedFee;
this.executedFeeToken = args.executedFeeToken;
this.receiver = args.receiver;
Expand Down
13 changes: 0 additions & 13 deletions src/routes/transactions/entities/swaps/twap-order-info.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export type TwapOrderInfo = {
// Nullable as TWAP may have too many parts, or is being previewed
executedBuyAmount: string | null;
// Nullable as TWAP may have too many parts, or is being previewed
executedSurplusFee: string | null;
executedFee: string | null;
executedFeeToken: TokenInfo;
sellToken: TokenInfo;
Expand Down Expand Up @@ -115,16 +114,6 @@ export class TwapOrderTransactionInfo
})
executedBuyAmount: string | null;

@ApiPropertyOptional({
type: String,
// Nullable as TWAP may have too many parts, or is being previewed
nullable: true,
description:
'The executed surplus fee raw amount (no decimals), or null if there are too many parts',
deprecated: true,
})
executedSurplusFee: string | null;

@ApiPropertyOptional({
type: String,
// Nullable as TWAP may have too many parts, or is being previewed
Expand Down Expand Up @@ -204,7 +193,6 @@ export class TwapOrderTransactionInfo
buyAmount: string;
executedSellAmount: string | null;
executedBuyAmount: string | null;
executedSurplusFee: string | null;
executedFee: string | null;
executedFeeToken: TokenInfo;
sellToken: TokenInfo;
Expand All @@ -229,7 +217,6 @@ export class TwapOrderTransactionInfo
this.buyAmount = args.buyAmount;
this.executedSellAmount = args.executedSellAmount;
this.executedBuyAmount = args.executedBuyAmount;
this.executedSurplusFee = args.executedSurplusFee;
this.executedFee = args.executedFee;
this.executedFeeToken = args.executedFeeToken;
this.sellToken = args.sellToken;
Expand Down
1 change: 0 additions & 1 deletion src/routes/transactions/helpers/swap-order.helper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe('Swap Order Helper tests', () => {
executedFeeAmount: order.executedFeeAmount,
executedSellAmount: order.executedSellAmount,
executedSellAmountBeforeFees: order.executedSellAmountBeforeFees,
executedSurplusFee: order.executedSurplusFee,
executedFee: order.executedFee,
executedFeeToken: order.executedFeeToken,
feeAmount: order.feeAmount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export class SwapOrderMapper {
trusted: buyToken.trusted,
}),
explorerUrl: this.swapOrderHelper.getOrderExplorerUrl(order).toString(),
executedSurplusFee: order.executedSurplusFee.toString(),
executedFee: order.executedFee.toString(),
executedFeeToken: new TokenInfo({
address: sellToken.address,
Expand Down
19 changes: 0 additions & 19 deletions src/routes/transactions/mappers/common/twap-order.mapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ describe('TwapOrderMapper', () => {
},
executedBuyAmount: '0',
executedSellAmount: '0',
executedSurplusFee: '0',
executedFee: '0',
executedFeeToken: {
address: sellToken.address,
Expand Down Expand Up @@ -221,7 +220,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '213586875483862141750',
executedSellAmountBeforeFees: '213586875483862141750',
executedFeeAmount: '0',
executedSurplusFee: '111111111',
executedFee: '111111111',
executedFeeToken: '0xbe72e441bf55620febc26715db68d3494213d8cb',
invalidated: false,
Expand Down Expand Up @@ -261,7 +259,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '213586875483862141750',
executedSellAmountBeforeFees: '213586875483862141750',
executedFeeAmount: '0',
executedSurplusFee: '111111111',
executedFee: '111111111',
executedFeeToken: '0xbe72e441bf55620febc26715db68d3494213d8cb',
invalidated: false,
Expand Down Expand Up @@ -339,7 +336,6 @@ describe('TwapOrderMapper', () => {
},
executedBuyAmount: '1379444631694674612',
executedSellAmount: '427173750967724283500',
executedSurplusFee: '222222222',
executedFee: '222222222',
executedFeeToken: {
address: sellToken.address,
Expand Down Expand Up @@ -409,7 +405,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '213586875483862141750',
executedSellAmountBeforeFees: '213586875483862141750',
executedFeeAmount: '0',
executedSurplusFee: '2135868754838621123',
executedFee: '2135868754838621123',
executedFeeToken: '0xbe72e441bf55620febc26715db68d3494213d8cb',
invalidated: false,
Expand Down Expand Up @@ -492,7 +487,6 @@ describe('TwapOrderMapper', () => {
},
executedBuyAmount: null,
executedSellAmount: null,
executedSurplusFee: null,
executedFee: null,
executedFeeToken: {
address: sellToken.address,
Expand Down Expand Up @@ -651,7 +645,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '213586875483862141750',
executedSellAmountBeforeFees: '213586875483862141750',
executedFeeAmount: '0',
executedSurplusFee: '111111111',
executedFee: '111111111',
executedFeeToken: '0xbe72e441bf55620febc26715db68d3494213d8cb',
invalidated: false,
Expand Down Expand Up @@ -751,7 +744,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '213586875483862141750',
executedSellAmountBeforeFees: '213586875483862141750',
executedFeeAmount: '0',
executedSurplusFee: '111111111',
executedFee: '111111111',
executedFeeToken: '0xbe72e441bf55620febc26715db68d3494213d8cb',
invalidated: false,
Expand Down Expand Up @@ -900,7 +892,6 @@ describe('TwapOrderMapper', () => {
},
executedBuyAmount: '0',
executedSellAmount: '0',
executedSurplusFee: '0',
executedFee: '0',
executedFeeToken: {
address: sellToken.address,
Expand Down Expand Up @@ -965,7 +956,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '388694804521426831',
executedSellAmountBeforeFees: '388694804521426831',
executedFeeAmount: '0',
executedSurplusFee: '3713410339758625',
executedFee: '3713410339758625',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down Expand Up @@ -1085,7 +1075,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '388694804521426831',
executedSellAmountBeforeFees: '388694804521426831',
executedFeeAmount: '0',
executedSurplusFee: '3713410339758625',
executedFee: '3713410339758625',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down Expand Up @@ -1204,7 +1193,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '388694804521426831',
executedSellAmountBeforeFees: '388694804521426831',
executedFeeAmount: '0',
executedSurplusFee: '3713410339758625',
executedFee: '3713410339758625',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down Expand Up @@ -1244,7 +1232,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '388694804521426831',
executedSellAmountBeforeFees: '388694804521426831',
executedFeeAmount: '0',
executedSurplusFee: '3835585092662741',
executedFee: '3835585092662741',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down Expand Up @@ -1366,7 +1353,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '388694804521426831',
executedSellAmountBeforeFees: '388694804521426831',
executedFeeAmount: '0',
executedSurplusFee: '3713410339758625',
executedFee: '3713410339758625',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down Expand Up @@ -1406,7 +1392,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '388694804521426831',
executedSellAmountBeforeFees: '388694804521426831',
executedFeeAmount: '0',
executedSurplusFee: '3835585092662741',
executedFee: '3835585092662741',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down Expand Up @@ -1446,7 +1431,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '0',
executedSellAmountBeforeFees: '0',
executedFeeAmount: '0',
executedSurplusFee: '0',
executedFee: '0',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down Expand Up @@ -1566,7 +1550,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '388694804521426831',
executedSellAmountBeforeFees: '388694804521426831',
executedFeeAmount: '0',
executedSurplusFee: '3713410339758625',
executedFee: '3713410339758625',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down Expand Up @@ -1606,7 +1589,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '388694804521426831',
executedSellAmountBeforeFees: '388694804521426831',
executedFeeAmount: '0',
executedSurplusFee: '3835585092662741',
executedFee: '3835585092662741',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down Expand Up @@ -1646,7 +1628,6 @@ describe('TwapOrderMapper', () => {
executedSellAmount: '0',
executedSellAmountBeforeFees: '0',
executedFeeAmount: '0',
executedSurplusFee: '0',
executedFee: '0',
executedFeeToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
invalidated: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ export class TwapOrderMapper {
buyAmount: twapOrderData.buyAmount,
executedSellAmount,
executedBuyAmount,
executedSurplusFee: executedFee,
executedFee,
// TODO: still tbd by CoW but this will be expressed in SURPLUS tokens
// (BUY tokens for SELL orders and SELL tokens for BUY orders)
Expand Down
Loading

0 comments on commit 1afa8fc

Please sign in to comment.