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

4313 stableswap lp poller 500 tx #4321

Merged
merged 12 commits into from
May 24, 2023
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- migrate:up
ALTER TABLE public.stableswap_pool_events
ADD COLUMN IF NOT EXISTS nonce numeric DEFAULT 0 NOT NULL;

ALTER TABLE public.stableswap_exchanges
ADD COLUMN IF NOT EXISTS nonce numeric DEFAULT 0 NOT NULL;

ALTER TABLE public.stableswap_lp_transfers
ADD COLUMN IF NOT EXISTS nonce numeric DEFAULT 0 NOT NULL;

-- migrate:down
ALTER TABLE stableswap_pool_events DROP COLUMN nonce;
ALTER TABLE stableswap_exchanges DROP COLUMN nonce;
ALTER TABLE stableswap_lp_transfers DROP COLUMN nonce;
12 changes: 8 additions & 4 deletions packages/adapters/database/db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ CREATE TABLE public.stableswap_exchanges (
transaction_hash character(66) NOT NULL,
"timestamp" integer NOT NULL,
balances numeric[] DEFAULT ARRAY[]::numeric[] NOT NULL,
fee numeric DEFAULT 0 NOT NULL
fee numeric DEFAULT 0 NOT NULL,
nonce numeric DEFAULT 0 NOT NULL
);


Expand All @@ -191,7 +192,8 @@ CREATE TABLE public.stableswap_pool_events (
block_number integer NOT NULL,
transaction_hash character(66) NOT NULL,
"timestamp" integer NOT NULL,
fees numeric[] DEFAULT ARRAY[]::numeric[] NOT NULL
fees numeric[] DEFAULT ARRAY[]::numeric[] NOT NULL,
nonce numeric DEFAULT 0 NOT NULL
);


Expand Down Expand Up @@ -771,7 +773,8 @@ CREATE TABLE public.stableswap_lp_transfers (
balances numeric[],
block_number integer NOT NULL,
transaction_hash character(66) NOT NULL,
"timestamp" integer NOT NULL
"timestamp" integer NOT NULL,
nonce numeric DEFAULT 0 NOT NULL
);


Expand Down Expand Up @@ -1345,4 +1348,5 @@ INSERT INTO public.schema_migrations (version) VALUES
('20230509123037'),
('20230509165732'),
('20230510210620'),
('20230519155643');
('20230519155643'),
('20230523134345');
3 changes: 3 additions & 0 deletions packages/adapters/database/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ const convertToDbStableSwapExchange = (exchange: StableSwapExchange): s.stablesw
block_number: exchange.blockNumber,
transaction_hash: exchange.transactionHash,
timestamp: exchange.timestamp,
nonce: exchange.nonce,
};
};

Expand All @@ -217,6 +218,7 @@ const convertToDbStableSwapPoolEvent = (event: StableSwapPoolEvent): s.stableswa
block_number: event.blockNumber,
transaction_hash: event.transactionHash,
timestamp: event.timestamp,
nonce: event.nonce,
};
};

Expand All @@ -234,6 +236,7 @@ const convertToDbStableSwapTransfer = (event: StableSwapTransfer): s.stableswap_
block_number: event.blockNumber,
transaction_hash: event.transactionHash,
timestamp: event.timestamp,
nonce: event.nonce,
};
};

Expand Down
90 changes: 90 additions & 0 deletions packages/adapters/database/src/zapatos/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4636,6 +4636,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `0`
*/
fee: number;
/**
* **stableswap_exchanges.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce: number;
}
export interface JSONSelectable {
/**
Expand Down Expand Up @@ -4716,6 +4722,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `0`
*/
fee: number;
/**
* **stableswap_exchanges.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce: number;
}
export interface Whereable {
/**
Expand Down Expand Up @@ -4796,6 +4808,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `0`
*/
fee?: number | db.Parameter<number> | db.SQLFragment | db.ParentColumn | db.SQLFragment<any, number | db.Parameter<number> | db.SQLFragment | db.ParentColumn>;
/**
* **stableswap_exchanges.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce?: number | db.Parameter<number> | db.SQLFragment | db.ParentColumn | db.SQLFragment<any, number | db.Parameter<number> | db.SQLFragment | db.ParentColumn>;
}
export interface Insertable {
/**
Expand Down Expand Up @@ -4876,6 +4894,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `0`
*/
fee?: number | db.Parameter<number> | db.DefaultType | db.SQLFragment;
/**
* **stableswap_exchanges.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce?: number | db.Parameter<number> | db.DefaultType | db.SQLFragment;
}
export interface Updatable {
/**
Expand Down Expand Up @@ -4956,6 +4980,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `0`
*/
fee?: number | db.Parameter<number> | db.DefaultType | db.SQLFragment | db.SQLFragment<any, number | db.Parameter<number> | db.DefaultType | db.SQLFragment>;
/**
* **stableswap_exchanges.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce?: number | db.Parameter<number> | db.DefaultType | db.SQLFragment | db.SQLFragment<any, number | db.Parameter<number> | db.DefaultType | db.SQLFragment>;
}
export type UniqueIndex = 'stableswap_exchanges_id_key' | 'stableswap_exchanges_pkey';
export type Column = keyof Selectable;
Expand Down Expand Up @@ -5246,6 +5276,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, no default
*/
timestamp: number;
/**
* **stableswap_lp_transfers.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce: number;
}
export interface JSONSelectable {
/**
Expand Down Expand Up @@ -5320,6 +5356,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, no default
*/
timestamp: number;
/**
* **stableswap_lp_transfers.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce: number;
}
export interface Whereable {
/**
Expand Down Expand Up @@ -5394,6 +5436,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, no default
*/
timestamp?: number | db.Parameter<number> | db.SQLFragment | db.ParentColumn | db.SQLFragment<any, number | db.Parameter<number> | db.SQLFragment | db.ParentColumn>;
/**
* **stableswap_lp_transfers.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce?: number | db.Parameter<number> | db.SQLFragment | db.ParentColumn | db.SQLFragment<any, number | db.Parameter<number> | db.SQLFragment | db.ParentColumn>;
}
export interface Insertable {
/**
Expand Down Expand Up @@ -5468,6 +5516,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, no default
*/
timestamp: number | db.Parameter<number> | db.SQLFragment;
/**
* **stableswap_lp_transfers.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce?: number | db.Parameter<number> | db.DefaultType | db.SQLFragment;
}
export interface Updatable {
/**
Expand Down Expand Up @@ -5542,6 +5596,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, no default
*/
timestamp?: number | db.Parameter<number> | db.SQLFragment | db.SQLFragment<any, number | db.Parameter<number> | db.SQLFragment>;
/**
* **stableswap_lp_transfers.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce?: number | db.Parameter<number> | db.DefaultType | db.SQLFragment | db.SQLFragment<any, number | db.Parameter<number> | db.DefaultType | db.SQLFragment>;
}
export type UniqueIndex = 'stableswap_lp_transfers_pkey';
export type Column = keyof Selectable;
Expand Down Expand Up @@ -5647,6 +5707,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `ARRAY[]::numeric[]`
*/
fees: number[];
/**
* **stableswap_pool_events.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce: number;
}
export interface JSONSelectable {
/**
Expand Down Expand Up @@ -5739,6 +5805,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `ARRAY[]::numeric[]`
*/
fees: number[];
/**
* **stableswap_pool_events.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce: number;
}
export interface Whereable {
/**
Expand Down Expand Up @@ -5831,6 +5903,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `ARRAY[]::numeric[]`
*/
fees?: number[] | db.Parameter<number[]> | db.SQLFragment | db.ParentColumn | db.SQLFragment<any, number[] | db.Parameter<number[]> | db.SQLFragment | db.ParentColumn>;
/**
* **stableswap_pool_events.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce?: number | db.Parameter<number> | db.SQLFragment | db.ParentColumn | db.SQLFragment<any, number | db.Parameter<number> | db.SQLFragment | db.ParentColumn>;
}
export interface Insertable {
/**
Expand Down Expand Up @@ -5923,6 +6001,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `ARRAY[]::numeric[]`
*/
fees?: number[] | db.Parameter<number[]> | db.DefaultType | db.SQLFragment;
/**
* **stableswap_pool_events.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce?: number | db.Parameter<number> | db.DefaultType | db.SQLFragment;
}
export interface Updatable {
/**
Expand Down Expand Up @@ -6015,6 +6099,12 @@ declare module 'zapatos/schema' {
* - `NOT NULL`, default: `ARRAY[]::numeric[]`
*/
fees?: number[] | db.Parameter<number[]> | db.DefaultType | db.SQLFragment | db.SQLFragment<any, number[] | db.Parameter<number[]> | db.DefaultType | db.SQLFragment>;
/**
* **stableswap_pool_events.nonce**
* - `numeric` in database
* - `NOT NULL`, default: `0`
*/
nonce?: number | db.Parameter<number> | db.DefaultType | db.SQLFragment | db.SQLFragment<any, number | db.Parameter<number> | db.DefaultType | db.SQLFragment>;
}
export type UniqueIndex = 'stableswap_pool_events_pkey';
export type Column = keyof Selectable;
Expand Down
2 changes: 2 additions & 0 deletions packages/adapters/database/test/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,7 @@ describe("Database client", () => {
block_number: event.blockNumber,
transaction_hash: event.transactionHash,
timestamp: event.timestamp,
nonce: String(event.nonce),
});
});
});
Expand All @@ -1335,6 +1336,7 @@ describe("Database client", () => {
block_number: event.blockNumber,
transaction_hash: event.transactionHash,
timestamp: event.timestamp,
nonce: String(event.nonce),
});
});
});
Expand Down
Loading