diff --git a/.all-contributorsrc b/.all-contributorsrc
index d9607ec5..3e1a42a2 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -108,6 +108,15 @@
"contributions": [
"code"
]
+ },
+ {
+ "login": "PoulavBhowmick03",
+ "name": "Poulav Bhowmick",
+ "avatar_url": "https://avatars.githubusercontent.com/u/133862694?v=4",
+ "profile": "https://poulav.vercel.app/",
+ "contributions": [
+ "code"
+ ]
}
],
"contributorsPerLine": 7,
diff --git a/.gitmodules b/.gitmodules
index 13973c8a..579ec75c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,9 +1,15 @@
-[submodule "onchain/lib/kakarot-rpc"]
- path = onchain/lib/kakarot-rpc
- url = https://github.com/kkrt-labs/kakarot-rpc
-[submodule "onchain/solidity_contracts/lib/forge-std"]
+[submodule "onchain/lib/kakarot-rpc"]
+ path = onchain/lib/kakarot-rpc
+ url = https://github.com/kkrt-labs/kakarot-rpc
+[submodule "onchain/solidity_contracts/lib/forge-std"]
path = onchain/solidity_contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
-[submodule "onchain/solidity_contracts/lib/kakarot-lib"]
- path = onchain/solidity_contracts/lib/kakarot-lib
- url = https://github.com/kkrt-labs/kakarot-lib
+[submodule "onchain/solidity_contracts/lib/kakarot-lib"]
+ path = onchain/solidity_contracts/lib/kakarot-lib
+ url = https://github.com/kkrt-labs/kakarot-lib
+[submodule "onchain/solidity_contracts/lib/openzeppelin-contracts-upgradeable"]
+ path = onchain/solidity_contracts/lib/openzeppelin-contracts-upgradeable
+ url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
+[submodule "onchain/solidity_contracts/lib/openzeppelin-contracts"]
+ path = onchain/solidity_contracts/lib/openzeppelin-contracts
+ url = https://github.com/OpenZeppelin/openzeppelin-contracts
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000..cbac5697
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "deno.enable": true
+}
diff --git a/README.md b/README.md
index 35b8d931..36d9ddf9 100644
--- a/README.md
+++ b/README.md
@@ -239,6 +239,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Yusuf Habib 💻 |
Isaac Onyemaechi Ugwu 💻 |
Oche 💻 |
+ Poulav Bhowmick 💻 |
diff --git a/apps/data-backend/src/services/telegram-app.ts b/apps/data-backend/src/services/telegram-app.ts
index a505f35f..056d8e3f 100644
--- a/apps/data-backend/src/services/telegram-app.ts
+++ b/apps/data-backend/src/services/telegram-app.ts
@@ -33,7 +33,7 @@ export function launchBot(token:string) {
// Handle stop events
enableGracefulStop(bot)
- return bot
+ // return bot
} catch (e) {
console.log("launchBot error", e)
}
diff --git a/apps/indexer/.env.example b/apps/indexer/.env.example
new file mode 100644
index 00000000..ebacfa1b
--- /dev/null
+++ b/apps/indexer/.env.example
@@ -0,0 +1,2 @@
+AUTH_TOKEN=dna_xxx
+POSTGRES_CONNECTION_STRING=postgresql://admin:postgres@localhost:5432/indexer
\ No newline at end of file
diff --git a/apps/indexer/Dockerfile b/apps/indexer/Dockerfile
index e5fa3914..79e6de98 100644
--- a/apps/indexer/Dockerfile
+++ b/apps/indexer/Dockerfile
@@ -11,4 +11,8 @@ FROM quay.io/apibara/sink-postgres:0.7.0-x86_64
WORKDIR /app
COPY ./src/* /app
+ARG POSTGRES_CONNECTION_STRING
+
+ENV POSTGRES_CONNECTION_STRING=${POSTGRES_CONNECTION_STRING}
+
ENTRYPOINT ["/nix/store/rh1g8pb7wfnyr527jfmkkc5lm3sa1f0l-apibara-sink-postgres-0.7.0/bin/apibara-sink-postgres"]
diff --git a/apps/indexer/README.md b/apps/indexer/README.md
index 0f159b8a..ba2dbc4e 100644
--- a/apps/indexer/README.md
+++ b/apps/indexer/README.md
@@ -5,16 +5,15 @@
## Install Postgres and Init the tables
```
-docker run --name afk-indexer -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 -v /afk-indexer:/docker-entrypoint-initdb.d postgres:16
+docker run --name afk-indexer -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=admin -e POSTGRES_DB=indexer -d -p 5432:5432 -v ./:/docker-entrypoint-initdb.d postgres:latest
```
# Test
-unrugmeme_deploy
+buy-token deploy
```
-apibara run ./src/pump-buy-coin.js -A dna_XXX
-
+apibara run ./src/buy-token.ts --allow-env .env -A dna_xxx
```
@@ -27,4 +26,4 @@ apibara run ./src/pump-buy-coin.js -A dna_XXX
```
### Run it
- docker run -it --env-file ./.env afk-indexer run /app/pump-deploy-coin.js --tls-accept-invalid-certificates=true --connection-string POSTGRES:INDEXER_DATABASE_URL
\ No newline at end of file
+ docker run -it --env-file ./.env afk-indexer run /app/buy-token.ts --tls-accept-invalid-certificates=true --allow-env-from-env POSTGRES_CONNECTION_STRING
\ No newline at end of file
diff --git a/apps/indexer/docker-compose.yml b/apps/indexer/docker-compose.yml
index 6542bf90..3c5137dc 100644
--- a/apps/indexer/docker-compose.yml
+++ b/apps/indexer/docker-compose.yml
@@ -6,7 +6,7 @@ services:
environment:
POSTGRES_DB: indexer
POSTGRES_USER: admin
- POSTGRES_PASSWORD: password
+ POSTGRES_PASSWORD: postgres
ports:
- '5432:5432'
volumes:
@@ -17,8 +17,9 @@ services:
unruggableMemecoin-deploy-indexer:
environment:
- AUTH_TOKEN=${AUTH_TOKEN}
+ - POSTGRES_CONNECTION_STRING=postgresql://admin:postgres@postgres:5432/indexer
image: quay.io/apibara/sink-postgres:latest
- command: 'run ./indexer/unruggableMemecoin-deploy.indexer.ts --connection-string postgresql://admin:password@postgres:5432/indexer -A ${AUTH_TOKEN}'
+ command: 'run ./indexer/unruggableMemecoin-deploy.indexer.ts --allow-env-from-env AUTH_TOKEN,POSTGRES_CONNECTION_STRING -A ${AUTH_TOKEN}'
volumes:
- ./src:/indexer
depends_on:
@@ -30,8 +31,9 @@ services:
unruggableMemecoin-launch-indexer:
environment:
- AUTH_TOKEN=${AUTH_TOKEN}
+ - POSTGRES_CONNECTION_STRING=postgresql://admin:postgres@postgres:5432/indexer
image: quay.io/apibara/sink-postgres:latest
- command: 'run ./indexer/unruggableMemecoin-launch.indexer.ts --connection-string postgresql://admin:password@postgres:5432/indexer -A ${AUTH_TOKEN}'
+ command: 'run ./indexer/unruggableMemecoin-launch.indexer.ts --allow-env-from-env AUTH_TOKEN,POSTGRES_CONNECTION_STRING -A ${AUTH_TOKEN}'
volumes:
- ./src:/indexer
depends_on:
@@ -43,8 +45,9 @@ services:
unruggableMemecoin-transfers-indexer:
environment:
- AUTH_TOKEN=${AUTH_TOKEN}
+ - POSTGRES_CONNECTION_STRING=postgresql://admin:postgres@postgres:5432/indexer
image: quay.io/apibara/sink-postgres:latest
- command: 'run ./indexer/unruggableMemecoin-transfers.indexer.ts --connection-string postgresql://admin:password@postgres:5432/indexer -A ${AUTH_TOKEN}'
+ command: 'run ./indexer/unruggableMemecoin-transfers.indexer.ts --allow-env-from-env AUTH_TOKEN,POSTGRES_CONNECTION_STRING -A ${AUTH_TOKEN}'
volumes:
- ./src:/indexer
depends_on:
@@ -53,6 +56,65 @@ services:
- backend
restart: on-failure
+ buy-indexer:
+ environment:
+ - AUTH_TOKEN=${AUTH_TOKEN}
+ - POSTGRES_CONNECTION_STRING=postgresql://admin:postgres@postgres:5432/indexer
+ image: quay.io/apibara/sink-postgres:latest
+ command: 'run ./indexer/buy-token.ts --allow-env-from-env AUTH_TOKEN,POSTGRES_CONNECTION_STRING -A ${AUTH_TOKEN}'
+ volumes:
+ - ./src:/indexer
+ depends_on:
+ - postgres
+ networks:
+ - backend
+ restart: on-failure
+
+
+ sell-indexer:
+ environment:
+ - AUTH_TOKEN=${AUTH_TOKEN}
+ - POSTGRES_CONNECTION_STRING=postgresql://admin:postgres@postgres:5432/indexer
+ image: quay.io/apibara/sink-postgres:latest
+ command: 'run ./indexer/sell-token.ts --allow-env-from-env AUTH_TOKEN,POSTGRES_CONNECTION_STRING -A ${AUTH_TOKEN}'
+ volumes:
+ - ./src:/indexer
+ depends_on:
+ - postgres
+ networks:
+ - backend
+ restart: on-failure
+
+ token-indexer:
+ environment:
+ - AUTH_TOKEN=${AUTH_TOKEN}
+ - POSTGRES_CONNECTION_STRING=postgresql://admin:postgres@postgres:5432/indexer
+ image: quay.io/apibara/sink-postgres:latest
+ command: 'run ./indexer/token-launch.ts --allow-env-from-env AUTH_TOKEN,POSTGRES_CONNECTION_STRING -A ${AUTH_TOKEN}'
+ volumes:
+ - ./src:/indexer
+ depends_on:
+ - postgres
+ networks:
+ - backend
+ restart: on-failure
+
+ deploy-indexer:
+ environment:
+ - AUTH_TOKEN=${AUTH_TOKEN}
+ - POSTGRES_CONNECTION_STRING=postgresql://admin:postgres@postgres:5432/indexer
+ image: quay.io/apibara/sink-postgres:latest
+ command: 'run ./indexer/deploy-token.ts --allow-env-from-env AUTH_TOKEN,POSTGRES_CONNECTION_STRING -A ${AUTH_TOKEN}'
+ volumes:
+ - ./src:/indexer
+ depends_on:
+ - postgres
+ networks:
+ - backend
+ restart: on-failure
+
+
+
networks:
backend:
driver: bridge
diff --git a/apps/indexer/init.sql b/apps/indexer/init.sql
index 1344bb05..feacd7d7 100644
--- a/apps/indexer/init.sql
+++ b/apps/indexer/init.sql
@@ -12,10 +12,8 @@ create table token_launch(
current_supply text,
liquidity_raised text,
price text,
- _cursor bigint
- timestamp TIMESTAMP,
-
-
+ _cursor bigint,
+ time_stamp TEXT
);
create table token_deploy(
@@ -32,8 +30,8 @@ create table token_deploy(
initial_supply text,
total_supply text,
created_at timestamp default current_timestamp,
- _cursor bigint
- timestamp TIMESTAMP,
+ _cursor bigint,
+ time_stamp TEXT
);
@@ -57,10 +55,11 @@ CREATE TABLE token_transactions (
current_supply TEXT,
liquidity_raised TEXT,
price TEXT,
+ protocol_fee TEXT,
amount TEXT,
- timestamp TIMESTAMP,
- _cursor bigint,
- transaction_type TEXT NOT NULL CHECK (transaction_type IN ('buy', 'sell')),,
+ _cursor BIGINT,
+ transaction_type TEXT NOT NULL CHECK (transaction_type IN ('buy', 'sell')),
+ time_stamp TEXT
);
diff --git a/apps/indexer/src/buy-token.js b/apps/indexer/src/buy-token.js
deleted file mode 100644
index df2a7af8..00000000
--- a/apps/indexer/src/buy-token.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import { hash, uint256 } from "https://esm.run/starknet@5.14";
-import { STARTING_BLOCK, LAUNCHPAD_ADDRESS } from "./constants";
-
-const filter = {
- header: {
- weak: true,
- },
- events: [
- {
- fromAddress: LAUNCHPAD_ADDRESS.SEPOLIA,
- keys: [hash.getSelectorFromName('BuyToken')],
- includeReceipt: false,
- },
- ],
-}
-
-export const config = {
- streamUrl: 'https://sepolia.starknet.a5a.ch',
- startingBlock: STARTING_BLOCK,
- network: 'starknet',
- finality: 'DATA_STATUS_ACCEPTED',
- filter,
- sinkType: 'postgres',
- sinkOptions: {
- connectionString: '', // Specify your PostgreSQL connection string here
- tableName: 'token_transactions',
- },
-}
-
-export default function DecodeBuyToken({ header, events }) {
- const { blockNumber, blockHash, timestamp } = header;
-
- return (events ?? []).map(({ event, transaction }) => {
- if (!event.data) return;
-
- const transactionHash = transaction.meta.hash;
- const [
- caller,
- token_address,
- amount_low, amount_high,
- price_low, price_high,
- protocol_fee_low, protocol_fee_high,
- initial_supply_low, initial_supply_high,
- ] = event.data;
-
- const amount = uint256.uint256ToBN({ low: amount_low, high: amount_high }).toString();
- const price = uint256.uint256ToBN({ low: price_low, high: price_high }).toString();
- const protocol_fee = uint256.uint256ToBN({ low: protocol_fee_low, high: protocol_fee_high }).toString();
- const initial_supply = uint256.uint256ToBN({ low: initial_supply_low, high: initial_supply_high }).toString();
-
- return {
- transaction_type: 'buy',
- network: 'starknet-sepolia',
- block_hash: blockHash,
- block_number: Number(blockNumber),
- block_timestamp: timestamp,
- transaction_hash: transactionHash,
- memecoin_address: token_address,
- owner_address: caller,
- initial_supply,
- price,
- protocol_fee,
- timestamp: new Date(timestamp * 1000).toISOString(), // UNIX timestamp to ISO string
- created_at: new Date().toISOString(),
- };
- });
-}
\ No newline at end of file
diff --git a/apps/indexer/src/buy-token.ts b/apps/indexer/src/buy-token.ts
new file mode 100644
index 00000000..9de2420d
--- /dev/null
+++ b/apps/indexer/src/buy-token.ts
@@ -0,0 +1,89 @@
+import { Block, hash, uint256 } from "./deps.ts";
+import { STARTING_BLOCK, LAUNCHPAD_ADDRESS } from "./constants.ts";
+
+const filter = {
+ header: {
+ weak: true
+ },
+ events: [
+ {
+ fromAddress: LAUNCHPAD_ADDRESS.SEPOLIA,
+ keys: [hash.getSelectorFromName("BuyToken")],
+ includeReceipt: false
+ }
+ ]
+};
+
+export const config = {
+ streamUrl: "https://sepolia.starknet.a5a.ch",
+ startingBlock: STARTING_BLOCK,
+ network: "starknet",
+ finality: "DATA_STATUS_ACCEPTED",
+ filter,
+ sinkType: "postgres",
+ sinkOptions: {
+ connectionString: Deno.env.get("POSTGRES_CONNECTION_STRING"),
+ tableName: "token_transactions"
+ }
+};
+
+export default function DecodeBuyToken({ header, events }: Block) {
+ const { blockNumber, blockHash, timestamp: block_timestamp } = header!;
+
+ return (events ?? []).map(({ event, transaction }) => {
+ if (!event.data) return;
+
+ const transactionHash = transaction.meta.hash;
+ const transfer_id = `${transactionHash}_${event.index}`;
+
+ const [caller, token_address] = event.keys!;
+
+ const [
+ amount_low,
+ amount_high,
+ price_low,
+ price_high,
+ protocol_fee_low,
+ protocol_fee_high,
+ last_price_low,
+ last_price_high,
+ timestamp,
+ quote_amount_low,
+ quote_amount_high
+ ] = event.data;
+
+ const amount = uint256
+ .uint256ToBN({ low: amount_low, high: amount_high })
+ .toString();
+ const price = uint256
+ .uint256ToBN({ low: price_low, high: price_high })
+ .toString();
+ const protocol_fee = uint256
+ .uint256ToBN({ low: protocol_fee_low, high: protocol_fee_high })
+ .toString();
+ const last_price = uint256
+ .uint256ToBN({ low: last_price_low, high: last_price_high })
+ .toString();
+ const quote_amount = uint256
+ .uint256ToBN({ low: quote_amount_low, high: quote_amount_high })
+ .toString();
+
+ return {
+ transfer_id,
+ network: "starknet-sepolia",
+ block_hash: blockHash,
+ block_number: Number(blockNumber),
+ block_timestamp: block_timestamp,
+ transaction_hash: transactionHash,
+ memecoin_address: token_address,
+ owner_address: caller,
+ last_price,
+ quote_amount,
+ price,
+ amount,
+ protocol_fee,
+ time_stamp: timestamp,
+ transaction_type: "buy"
+ };
+ });
+}
diff --git a/apps/indexer/src/constants.js b/apps/indexer/src/constants.js
deleted file mode 100644
index c5ec894b..00000000
--- a/apps/indexer/src/constants.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export const FACTORY_ADDRESS = '0x01a46467a9246f45c8c340f1f155266a26a71c07bd55d36e8d1c7d0d438a2dbc'
-export const STARTING_BLOCK = 100_000
-export const LAUNCHPAD_ADDRESS = {
- // SEPOLIA:"0x74acb6752abb734a7b3388567429217988e02409d9bf43c5586dc2c4f8baf40",
- // SEPOLIA:"0x29a532e6933a6d6f9939e59469d96b52b7c38561745331302e1a29f035e4dd0",
- SEPOLIA:"0x3798921000573bfc442d8153fc088db97bd3794f5ed19ea8c0846db5378f4af"
-}
diff --git a/apps/indexer/src/constants.ts b/apps/indexer/src/constants.ts
new file mode 100644
index 00000000..93b2a494
--- /dev/null
+++ b/apps/indexer/src/constants.ts
@@ -0,0 +1,8 @@
+export const FACTORY_ADDRESS =
+ "0x01a46467a9246f45c8c340f1f155266a26a71c07bd55d36e8d1c7d0d438a2dbc";
+export const STARTING_BLOCK = 140_000;
+export const LAUNCHPAD_ADDRESS = {
+ // SEPOLIA:"0x74acb6752abb734a7b3388567429217988e02409d9bf43c5586dc2c4f8baf40",
+ // SEPOLIA:"0x29a532e6933a6d6f9939e59469d96b52b7c38561745331302e1a29f035e4dd0",
+ SEPOLIA: "0x3798921000573bfc442d8153fc088db97bd3794f5ed19ea8c0846db5378f4af"
+};
diff --git a/apps/indexer/src/deploy-token.js b/apps/indexer/src/deploy-token.js
deleted file mode 100644
index b2e88bb0..00000000
--- a/apps/indexer/src/deploy-token.js
+++ /dev/null
@@ -1,70 +0,0 @@
-import { LAUNCHPAD_ADDRESS, STARTING_BLOCK } from './constants.js'
-import { hash, uint256, shortString } from "https://esm.run/starknet@5.14";
-
-const filter = {
- header: {
- weak: true,
- },
- events: [
- {
- fromAddress: LAUNCHPAD_ADDRESS.SEPOLIA,
- keys: [hash.getSelectorFromName('CreateToken')],
- includeReceipt: false,
- },
- ],
-}
-
-export const config = {
- streamUrl: 'https://sepolia.starknet.a5a.ch',
- startingBlock: STARTING_BLOCK,
- network: 'starknet',
- finality: 'DATA_STATUS_ACCEPTED',
- filter,
- sinkType: 'postgres',
- sinkOptions: {
- connectionString: '',
- tableName: 'token_deploy',
- },
-}
-
-export default function DecodeTokenDeploy({ header, events }) {
- const { blockNumber, blockHash, timestamp } = header;
-
- return (events ?? []).map(({ event, transaction }) => {
- if (!event.data || !event.keys) return;
-
- const transactionHash = transaction.meta.hash;
- const [caller, token_address,
- // name, symbol
- ] = event.keys;
-
- const [
- initial_supply_low, initial_supply_high,
- total_supply_low, total_supply_high,
- symbol, name
- ] = event.data;
-
- const initial_supply = uint256.uint256ToBN({ low: initial_supply_low, high: initial_supply_high }).toString();
- const total_supply = uint256.uint256ToBN({ low: total_supply_low, high: total_supply_high }).toString();
- const name_decoded = shortString.decodeShortString(name);
- const symbol_decoded = shortString.decodeShortString(symbol);
-
- return {
- network: 'starknet-sepolia',
- block_hash: blockHash,
- block_number: Number(blockNumber),
- block_timestamp: timestamp,
- transaction_hash: transactionHash,
- memecoin_address: token_address,
- owner_address: caller,
- name: name_decoded,
- symbol: symbol_decoded,
- initial_supply,
- total_supply,
- created_at: new Date().toISOString(),
- _cursor: transaction.meta.cursor,
- timestamp: new Date(timestamp * 1000).toISOString(),
-
- };
- });
-}
\ No newline at end of file
diff --git a/apps/indexer/src/deploy-token.ts b/apps/indexer/src/deploy-token.ts
new file mode 100644
index 00000000..dcf32007
--- /dev/null
+++ b/apps/indexer/src/deploy-token.ts
@@ -0,0 +1,91 @@
+import { LAUNCHPAD_ADDRESS, STARTING_BLOCK } from "./constants.ts";
+import { Block, hash, uint256, shortString } from "./deps.ts";
+
+const filter = {
+ header: {
+ weak: true
+ },
+ events: [
+ {
+ fromAddress: LAUNCHPAD_ADDRESS.SEPOLIA,
+ keys: [hash.getSelectorFromName("CreateToken")],
+ includeReceipt: false
+ }
+ ]
+};
+
+export const config = {
+ streamUrl: "https://sepolia.starknet.a5a.ch",
+ startingBlock: STARTING_BLOCK,
+ network: "starknet",
+ finality: "DATA_STATUS_ACCEPTED",
+ filter,
+ sinkType: "postgres",
+ sinkOptions: {
+ connectionString: Deno.env.get("POSTGRES_CONNECTION_STRING"),
+ tableName: "token_deploy"
+ }
+};
+
+export default function DecodeTokenDeploy({ header, events }: Block) {
+ const { blockNumber, blockHash, timestamp } = header!;
+
+ return (events ?? []).map(({ event, transaction }) => {
+ if (!event.data || !event.keys) return;
+
+ const transactionHash = transaction.meta.hash;
+ const [caller, token_address] = event.keys;
+
+ const [
+ symbol,
+ name,
+ initial_supply_low,
+ initial_supply_high,
+ total_supply_low,
+ total_supply_high
+ ] = event.data;
+
+ const symbol_decoded = token_address
+ ? shortString.decodeShortString(symbol.replace(/0x0+/, "0x"))
+ : "";
+ const name_decoded = name
+ ? shortString.decodeShortString(name.replace(/0x0+/, "0x"))
+ : "";
+ const initial_supply = uint256
+ .uint256ToBN({ low: initial_supply_low, high: initial_supply_high })
+ .toString();
+ const total_supply = uint256
+ .uint256ToBN({ low: total_supply_low, high: total_supply_high })
+ .toString();
+
+ console.log({
+ memecoin_address: token_address,
+ network: "starknet-sepolia",
+ block_hash: blockHash,
+ block_number: Number(blockNumber),
+ block_timestamp: timestamp,
+ transaction_hash: transactionHash,
+ owner_address: caller,
+ name: name_decoded,
+ symbol: symbol_decoded,
+ initial_supply,
+ total_supply,
+ time_stamp: timestamp
+ });
+
+ return {
+ memecoin_address: token_address,
+ network: "starknet-sepolia",
+ block_hash: blockHash,
+ block_number: Number(blockNumber),
+ block_timestamp: timestamp,
+ transaction_hash: transactionHash,
+ owner_address: caller,
+ name: name_decoded,
+ symbol: symbol_decoded,
+ initial_supply,
+ total_supply,
+ time_stamp: timestamp
+ };
+ });
+}
diff --git a/apps/indexer/src/deps.js b/apps/indexer/src/deps.js
deleted file mode 100644
index b7b93c9e..00000000
--- a/apps/indexer/src/deps.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export { ec, hash, uint256, shortString } from 'https://esm.sh/starknet@5.14'
-export { formatUnits } from 'https://esm.sh/viem@1.4'
-
-export { Block, FieldElement, Filter } from 'https://esm.sh/@apibara/indexer@0.3/starknet'
-// export { Config, NetworkOptions } from "https://esm.sh/@apibara/indexer";
-// export { Console } from "https://esm.sh/@apibara/indexer/sink/console";
\ No newline at end of file
diff --git a/apps/indexer/src/deps.ts b/apps/indexer/src/deps.ts
new file mode 100644
index 00000000..70496773
--- /dev/null
+++ b/apps/indexer/src/deps.ts
@@ -0,0 +1,13 @@
+export {
+ ec,
+ hash,
+ uint256,
+ shortString,
+ cairo
+} from "https://esm.sh/starknet@5.14.1";
+export { formatUnits } from "https://esm.sh/viem@1.4.2";
+export type {
+ Block,
+ FieldElement,
+ Filter
+} from "https://esm.sh/@apibara/indexer@0.3.1/starknet";
diff --git a/apps/indexer/src/script.js b/apps/indexer/src/script.js
deleted file mode 100644
index 476627be..00000000
--- a/apps/indexer/src/script.js
+++ /dev/null
@@ -1,18 +0,0 @@
-export const config = {
- streamUrl: "https://sepolia.starknet.a5a.ch",
- startingBlock: 10_000,
- network: "starknet",
- finality: "DATA_STATUS_ACCEPTED",
- filter: {
- header: {},
- },
- // sinkType: "console",
- sinkType: "postgres",
- sinkOptions: {},
- };
-
- // This transform does nothing.
- export default function transform(block) {
- return block;
-}
-
diff --git a/apps/indexer/src/script.ts b/apps/indexer/src/script.ts
new file mode 100644
index 00000000..73584065
--- /dev/null
+++ b/apps/indexer/src/script.ts
@@ -0,0 +1,18 @@
+import { Block } from "./deps.ts";
+
+export const config = {
+ streamUrl: "https://sepolia.starknet.a5a.ch",
+ startingBlock: 10_000,
+ network: "starknet",
+ finality: "DATA_STATUS_ACCEPTED",
+ filter: {
+ header: {}
+ },
+ sinkType: "postgres",
+ sinkOptions: {}
+};
+
+// This transform does nothing.
+export default function transform(block: Block) {
+ return block;
+}
diff --git a/apps/indexer/src/sell-token.js b/apps/indexer/src/sell-token.js
deleted file mode 100644
index f93ffd3c..00000000
--- a/apps/indexer/src/sell-token.js
+++ /dev/null
@@ -1,74 +0,0 @@
-import { hash, uint256 } from "https://esm.run/starknet@5.14";
-import { STARTING_BLOCK, LAUNCHPAD_ADDRESS } from "./constants";
-
-const filter = {
- header: {
- weak: true,
- },
- events: [
- {
- fromAddress: LAUNCHPAD_ADDRESS.SEPOLIA,
- keys: [hash.getSelectorFromName('SellToken')],
- includeReceipt: false,
- },
- ],
-}
-
-export const config = {
- streamUrl: 'https://sepolia.starknet.a5a.ch',
- startingBlock: STARTING_BLOCK,
- network: 'starknet',
- finality: 'DATA_STATUS_ACCEPTED',
- filter,
- sinkType: 'postgres',
- sinkOptions: {
- connectionString: '', // Your PostgreSQL connection string
- tableName: 'token_transactions', // Using the same table for buy and sell
- },
-}
-
-export default function DecodeSellToken({ header, events }) {
- const { blockNumber, blockHash, timestamp } = header;
-
- return (events ?? []).map(({ event, transaction }) => {
- if (!event.data) return;
-
- const transactionHash = transaction.meta.hash;
- const [
- seller,
- token_address,
- amount_low, amount_high,
- price_low, price_high,
- protocol_fee_low, protocol_fee_high,
- total_supply_low, total_supply_high,
- ] = event.data;
-
- const amount = uint256.uint256ToBN({ low: amount_low, high: amount_high }).toString();
- const price = uint256.uint256ToBN({ low: price_low, high: price_high }).toString();
- const protocol_fee = uint256.uint256ToBN({ low: protocol_fee_low, high: protocol_fee_high }).toString();
- const total_supply = uint256.uint256ToBN({ low: total_supply_low, high: total_supply_high }).toString();
-
- return {
- transaction_type: 'sell',
- network: 'starknet-sepolia',
- block_hash: blockHash,
- block_number: Number(blockNumber),
- block_timestamp: timestamp,
- transaction_hash: transactionHash,
- memecoin_address: token_address,
- owner_address: seller,
- last_price: price,
- quote_amount: '',
- coin_received: '',
- initial_supply: '',
- total_supply,
- price,
- amount,
- timestamp: new Date(timestamp * 1000).toISOString(),
- created_at: new Date().toISOString(),
- };
- });
-}
-
-
-
diff --git a/apps/indexer/src/sell-token.ts b/apps/indexer/src/sell-token.ts
new file mode 100644
index 00000000..7269eaab
--- /dev/null
+++ b/apps/indexer/src/sell-token.ts
@@ -0,0 +1,89 @@
+import { Block, hash, uint256 } from "./deps.ts";
+import { STARTING_BLOCK, LAUNCHPAD_ADDRESS } from "./constants.ts";
+
+const filter = {
+ header: {
+ weak: true
+ },
+ events: [
+ {
+ fromAddress: LAUNCHPAD_ADDRESS.SEPOLIA,
+ keys: [hash.getSelectorFromName("SellToken")],
+ includeReceipt: false
+ }
+ ]
+};
+
+export const config = {
+ streamUrl: "https://sepolia.starknet.a5a.ch",
+ startingBlock: STARTING_BLOCK,
+ network: "starknet",
+ finality: "DATA_STATUS_ACCEPTED",
+ filter,
+ sinkType: "postgres",
+ sinkOptions: {
+ connectionString: Deno.env.get("POSTGRES_CONNECTION_STRING"), // Your PostgreSQL connection string
+ tableName: "token_transactions" // Using the same table for buy and sell
+ }
+};
+
+export default function DecodeSellToken({ header, events }: Block) {
+ const { blockNumber, blockHash, timestamp: block_timestamp } = header!;
+
+ return (events ?? []).map(({ event, transaction }) => {
+ if (!event.data) return;
+
+ const transactionHash = transaction.meta.hash;
+ const transfer_id = `${transactionHash}_${event.index}`;
+
+ const [caller, token_address] = event.keys!;
+
+ const [
+ amount_low,
+ amount_high,
+ price_low,
+ price_high,
+ protocol_fee_low,
+ protocol_fee_high,
+ last_price_low,
+ last_price_high,
+ timestamp,
+ quote_amount_low,
+ quote_amount_high
+ ] = event.data;
+
+ const amount = uint256
+ .uint256ToBN({ low: amount_low, high: amount_high })
+ .toString();
+ const price = uint256
+ .uint256ToBN({ low: price_low, high: price_high })
+ .toString();
+ const protocol_fee = uint256
+ .uint256ToBN({ low: protocol_fee_low, high: protocol_fee_high })
+ .toString();
+ const last_price = uint256
+ .uint256ToBN({ low: last_price_low, high: last_price_high })
+ .toString();
+ const quote_amount = uint256
+ .uint256ToBN({ low: quote_amount_low, high: quote_amount_high })
+ .toString();
+
+ return {
+ transfer_id,
+ network: "starknet-sepolia",
+ block_hash: blockHash,
+ block_number: Number(blockNumber),
+ block_timestamp: block_timestamp,
+ transaction_hash: transactionHash,
+ memecoin_address: token_address,
+ owner_address: caller,
+ last_price,
+ quote_amount,
+ price,
+ amount,
+ protocol_fee,
+ time_stamp: timestamp,
+ transaction_type: "sell"
+ };
+ });
+}
diff --git a/apps/indexer/src/token-launch.js b/apps/indexer/src/token-launch.js
deleted file mode 100644
index 559db270..00000000
--- a/apps/indexer/src/token-launch.js
+++ /dev/null
@@ -1,83 +0,0 @@
-// import { Block, hash, shortString, uint256 } from './deps.js'
-import { FACTORY_ADDRESS, LAUNCHPAD_ADDRESS, STARTING_BLOCK } from './constants.js'
-import { hash, uint256, shortString, cairo } from "https://esm.run/starknet@5.14";
-import { formatUnits } from "https://esm.run/viem@1.4";
-
-const filter = {
- header: {
- weak: true,
- },
- events: [
- {
- fromAddress: LAUNCHPAD_ADDRESS.SEPOLIA,
- keys: [hash.getSelectorFromName('CreateLaunch')],
- includeReceipt: false,
- },
- ],
-}
-
-export const config = {
- streamUrl: 'https://sepolia.starknet.a5a.ch',
- startingBlock: STARTING_BLOCK,
- network: 'starknet',
- finality: 'DATA_STATUS_ACCEPTED',
- filter,
- sinkType: 'postgres',
- sinkOptions: {
- connectionString: '',
- tableName: 'token_launch',
- },
-}
-
-export default function DecodeTokenLaunchDeploy({ header, events }) {
- const { blockNumber, blockHash, timestamp } = header;
-
- return (events ?? []).map(({ event, transaction }) => {
- if (!event.data) return
-
- const transactionHash = transaction.meta.hash
- console.log("event data", event?.data)
-
- const [owner, token_address, ] = event.keys
- const [name, symbol, initial_supply_low, initial_supply_high, total_supply_low, total_supply_high] = event.data
- console.log("owner", owner)
- console.log("token_address", token_address)
- console.log("name", name)
- console.log("symbol", symbol)
- console.log("initial_supply_low", initial_supply_low)
- console.log("total_supply_low", total_supply_low)
-
- const name_decoded = shortString.decodeShortString(name.replace(/0x0+/, '0x'))
- const symbol_decoded = shortString.decodeShortString(symbol.replace(/0x0+/, '0x'))
- const quote_token_decoded = token_address ? shortString.decodeShortString(token_address.replace(/0x0+/, '0x')) : '';
- const exchange_name_decoded = exchange_name ? shortString.decodeShortString(exchange_name.replace(/0x0+/, '0x')) : '';
- const price_decoded = price ? shortString.decodeShortString(price.replace(/0x0+/, '0x')) : '';
- const liquidity_raised_decoded = liquidity_raised ? uint256.uint256ToBN({ low: liquidity_raised, high: 0 }).toString() : '0';
-
- let total_supply= cairo.uint256(0)
- if(total_supply_high && total_supply_low) {
- total_supply = uint256.uint256ToBN({ low: total_supply_low, high: total_supply_high }).toString()
-
- }
- console.log("total_supply", total_supply)
-
- return {
- network: 'starknet-sepolia',
- block_hash: blockHash,
- block_number: Number(blockNumber),
- block_timestamp: timestamp,
- transaction_hash: transactionHash,
- memecoin_address: token_address,
- quote_token: quote_token_decoded,
- exchange_name: exchange_name_decoded,
- created_at: new Date().toISOString(),
- total_supply,
- current_supply,
- liquidity_raised: liquidity_raised_decoded,
- price: price_decoded,
- _cursor: transaction.meta.cursor,
- timestamp: new Date(timestamp * 1000).toISOString(),
-
- }
- })
-}
diff --git a/apps/indexer/src/token-launch.ts b/apps/indexer/src/token-launch.ts
new file mode 100644
index 00000000..f013d8d6
--- /dev/null
+++ b/apps/indexer/src/token-launch.ts
@@ -0,0 +1,86 @@
+import {
+ FACTORY_ADDRESS,
+ LAUNCHPAD_ADDRESS,
+ STARTING_BLOCK
+} from "./constants.ts";
+import { Block, hash, uint256, shortString, cairo } from "./deps.ts";
+
+const filter = {
+ header: {
+ weak: true
+ },
+ events: [
+ {
+ fromAddress: LAUNCHPAD_ADDRESS.SEPOLIA,
+ keys: [hash.getSelectorFromName("CreateLaunch")],
+ includeReceipt: false
+ }
+ ]
+};
+
+export const config = {
+ streamUrl: "https://sepolia.starknet.a5a.ch",
+ startingBlock: STARTING_BLOCK,
+ network: "starknet",
+ finality: "DATA_STATUS_ACCEPTED",
+ filter,
+ sinkType: "postgres",
+ sinkOptions: {
+ connectionString: Deno.env.get("POSTGRES_CONNECTION_STRING"),
+ tableName: "token_launch"
+ }
+};
+
+export default function DecodeTokenLaunchDeploy({ header, events }: Block) {
+ const { blockNumber, blockHash, timestamp } = header!;
+
+ return (events ?? []).map(({ event, transaction }) => {
+ if (!event.data) return;
+
+ const transactionHash = transaction.meta.hash;
+
+ const [caller, token_address] = event.keys!;
+ const [
+ amount_low,
+ amount_high,
+ price,
+ total_supply_low,
+ total_supply_high,
+ slope_low,
+ slope_high,
+ threshold_liquidity_low,
+ threshold_liquidity_high
+ ] = event.data;
+
+ const amount = uint256
+ .uint256ToBN({ low: amount_low, high: amount_high })
+ .toString();
+ const price_decoded = price
+ ? shortString.decodeShortString(price.replace(/0x0+/, "0x"))
+ : "";
+ const total_supply = uint256
+ .uint256ToBN({ low: total_supply_low, high: total_supply_high })
+ .toString();
+ const slope = uint256
+ .uint256ToBN({ low: slope_low, high: slope_high })
+ .toString();
+ const threshold_liquidity = uint256
+ .uint256ToBN({
+ low: threshold_liquidity_low,
+ high: threshold_liquidity_high
+ })
+ .toString();
+
+ return {
+ memecoin_address: token_address,
+ network: "starknet-sepolia",
+ block_hash: blockHash,
+ block_number: Number(blockNumber),
+ block_timestamp: timestamp,
+ transaction_hash: transactionHash,
+ total_supply,
+ price: price_decoded,
+ time_stamp: timestamp
+ };
+ });
+}
diff --git a/apps/indexer/src/transfer.js b/apps/indexer/src/transfer.ts
similarity index 64%
rename from apps/indexer/src/transfer.js
rename to apps/indexer/src/transfer.ts
index c18c1096..a2f760b1 100644
--- a/apps/indexer/src/transfer.js
+++ b/apps/indexer/src/transfer.ts
@@ -1,5 +1,4 @@
-import { hash, uint256 } from "https://esm.run/starknet@5.14";
-import { formatUnits } from "https://esm.run/viem@1.4";
+import { hash, uint256, formatUnits, Block } from "./deps.ts";
const DECIMALS = 18;
@@ -13,39 +12,40 @@ export const config = {
{
fromAddress:
"0x03e85bfbb8e2a42b7bead9e88e9a1b19dbccf661471061807292120462396ec9",
- keys: [hash.getSelectorFromName("Transfer")],
- },
- ],
+ keys: [hash.getSelectorFromName("Transfer")]
+ }
+ ]
},
sinkType: "postgres",
sinkOptions: {
- tableName: "transfers",
- },
+ connectionString: Deno.env.get("POSTGRES_CONNECTION_STRING"),
+ tableName: "transfers"
+ }
};
-export default function transform({ header, events }) {
- const { blockNumber, blockHash, timestamp } = header;
- return events.map(({ event, receipt }) => {
+export default function transform({ header, events }: Block) {
+ const { blockNumber, blockHash, timestamp } = header!;
+
+ return (events ?? []).map(({ event, receipt }) => {
const { transactionHash } = receipt;
const transferId = `${transactionHash}_${event.index}`;
- const [fromAddress, toAddress, amountLow, amountHigh] = event.data;
+ const [fromAddress, toAddress, amountLow, amountHigh] = event.data!;
const amountRaw = uint256.uint256ToBN({ low: amountLow, high: amountHigh });
const amount = formatUnits(amountRaw, DECIMALS);
- // Convert to snake_case because it works better with postgres.
return {
network: "starknet-sepolia",
symbol: "ETH",
block_hash: blockHash,
- block_number: +blockNumber,
+ block_number: Number(blockNumber),
block_timestamp: timestamp,
transaction_hash: transactionHash,
transfer_id: transferId,
from_address: fromAddress,
to_address: toAddress,
amount: amount,
- amount_raw: amountRaw.toString(),
+ amount_raw: amountRaw.toString()
};
});
}
diff --git a/apps/indexer/src/unruggableMemecoin-deploy.indexer.js b/apps/indexer/src/unruggableMemecoin-deploy.indexer.js
deleted file mode 100644
index afd86604..00000000
--- a/apps/indexer/src/unruggableMemecoin-deploy.indexer.js
+++ /dev/null
@@ -1,58 +0,0 @@
-import { hash, shortString, uint256 } from './deps.ts'
-import { FACTORY_ADDRESS, STARTING_BLOCK } from './constants.ts'
-
-const filter = {
- header: {
- weak: true,
- },
- events: [
- {
- fromAddress: FACTORY_ADDRESS,
- keys: [hash.getSelectorFromName('MemecoinCreated')],
- includeReceipt: false,
- },
- ],
-}
-
-export const config = {
- streamUrl: 'https://mainnet.starknet.a5a.ch',
- startingBlock: STARTING_BLOCK,
- network: 'starknet',
- finality: 'DATA_STATUS_ACCEPTED',
- filter,
- sinkType: 'postgres',
- sinkOptions: {
- connectionString: '',
- tableName: 'unrugmeme_deploy',
- },
-}
-
-export default function DecodeUnruggableMemecoinDeploy({ header, events }) {
- const { blockNumber, blockHash, timestamp } = header
-
- return (events ?? []).map(({ event, transaction }) => {
- if (!event.data) return
-
- const transactionHash = transaction.meta.hash
-
- const [owner, name, symbol, initial_supply_low, initial_supply_high, memecoin_address] = event.data
-
- const name_decoded = shortString.decodeShortString(name.replace(/0x0+/, '0x'))
- const symbol_decoded = shortString.decodeShortString(symbol.replace(/0x0+/, '0x'))
- const initial_supply = uint256.uint256ToBN({ low: initial_supply_low, high: initial_supply_high }).toString()
-
- return {
- network: 'starknet-mainnet',
- block_hash: blockHash,
- block_number: Number(blockNumber),
- block_timestamp: timestamp,
- transaction_hash: transactionHash,
- memecoin_address: memecoin_address,
- owner_address: owner,
- name: name_decoded,
- symbol: symbol_decoded,
- initial_supply: initial_supply,
- created_at: new Date().toISOString(),
- }
- })
-}
diff --git a/apps/indexer/src/unruggableMemecoin-deploy.indexer.ts b/apps/indexer/src/unruggableMemecoin-deploy.indexer.ts
new file mode 100644
index 00000000..3e1abbed
--- /dev/null
+++ b/apps/indexer/src/unruggableMemecoin-deploy.indexer.ts
@@ -0,0 +1,74 @@
+import { Block, hash, shortString, uint256 } from "./deps.ts";
+import { FACTORY_ADDRESS, STARTING_BLOCK } from "./constants.ts";
+
+const filter = {
+ header: {
+ weak: true
+ },
+ events: [
+ {
+ fromAddress: FACTORY_ADDRESS,
+ keys: [hash.getSelectorFromName("MemecoinCreated")],
+ includeReceipt: false
+ }
+ ]
+};
+
+export const config = {
+ streamUrl: "https://mainnet.starknet.a5a.ch",
+ startingBlock: STARTING_BLOCK,
+ network: "starknet",
+ finality: "DATA_STATUS_ACCEPTED",
+ filter,
+ sinkType: "postgres",
+ sinkOptions: {
+ connectionString: Deno.env.get("POSTGRES_CONNECTION_STRING"),
+ tableName: "unrugmeme_deploy"
+ }
+};
+
+export default function DecodeUnruggableMemecoinDeploy({
+ header,
+ events
+}: Block) {
+ const { blockNumber, blockHash, timestamp } = header!;
+
+ return (events ?? []).map(({ event, transaction }) => {
+ if (!event.data) return;
+
+ const transactionHash = transaction.meta.hash;
+
+ const [
+ owner,
+ name,
+ symbol,
+ initial_supply_low,
+ initial_supply_high,
+ memecoin_address
+ ] = event.data;
+
+ const name_decoded = shortString.decodeShortString(
+ name.replace(/0x0+/, "0x")
+ );
+ const symbol_decoded = shortString.decodeShortString(
+ symbol.replace(/0x0+/, "0x")
+ );
+ const initial_supply = uint256
+ .uint256ToBN({ low: initial_supply_low, high: initial_supply_high })
+ .toString();
+
+ return {
+ network: "starknet-mainnet",
+ block_hash: blockHash,
+ block_number: Number(blockNumber),
+ block_timestamp: timestamp,
+ transaction_hash: transactionHash,
+ memecoin_address: memecoin_address,
+ owner_address: owner,
+ name: name_decoded,
+ symbol: symbol_decoded,
+ initial_supply: initial_supply,
+ created_at: new Date().toISOString()
+ };
+ });
+}
diff --git a/apps/indexer/src/unruggableMemecoin-launch.indexer.js b/apps/indexer/src/unruggableMemecoin-launch.indexer.js
deleted file mode 100644
index 6ccb8678..00000000
--- a/apps/indexer/src/unruggableMemecoin-launch.indexer.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import { Block, hash, shortString } from './deps.js'
-import { FACTORY_ADDRESS, STARTING_BLOCK } from './constants.js'
-
-const filter = {
- header: {
- weak: true,
- },
- events: [
- {
- fromAddress: FACTORY_ADDRESS,
- keys: [hash.getSelectorFromName('MemecoinLaunched')],
- includeReceipt: false,
- },
- ],
-}
-
-export const config = {
- streamUrl: 'https://mainnet.starknet.a5a.ch',
- startingBlock: STARTING_BLOCK,
- network: 'starknet',
- finality: 'DATA_STATUS_ACCEPTED',
- filter,
- sinkType: 'postgres',
- sinkOptions: {
- connectionString: '',
- tableName: 'unrugmeme_launch',
- },
-}
-
-export default function DecodeUnruggableMemecoinLaunch({ header, events }) {
- const { blockNumber, blockHash, timestamp } = header
-
- return (events ?? []).map(({ event, transaction }) => {
- if (!event.data) return
-
- const transactionHash = transaction.meta.hash
-
- const [memecoin_address, quote_token, exchange_name] = event.data
-
- const exchange_name_decoded = shortString.decodeShortString(exchange_name.replace(/0x0+/, '0x'))
-
- return {
- network: 'starknet-mainnet',
- block_hash: blockHash,
- block_number: Number(blockNumber),
- block_timestamp: timestamp,
- transaction_hash: transactionHash,
- memecoin_address: memecoin_address,
- quote_token: quote_token,
- exchange_name: exchange_name_decoded,
- created_at: new Date().toISOString(),
- }
- })
-}
diff --git a/apps/indexer/src/unruggableMemecoin-launch.indexer.ts b/apps/indexer/src/unruggableMemecoin-launch.indexer.ts
new file mode 100644
index 00000000..31a957a1
--- /dev/null
+++ b/apps/indexer/src/unruggableMemecoin-launch.indexer.ts
@@ -0,0 +1,59 @@
+import { Block, hash, shortString } from "./deps.ts";
+import { FACTORY_ADDRESS, STARTING_BLOCK } from "./constants.ts";
+
+const filter = {
+ header: {
+ weak: true
+ },
+ events: [
+ {
+ fromAddress: FACTORY_ADDRESS,
+ keys: [hash.getSelectorFromName("MemecoinLaunched")],
+ includeReceipt: false
+ }
+ ]
+};
+
+export const config = {
+ streamUrl: "https://mainnet.starknet.a5a.ch",
+ startingBlock: STARTING_BLOCK,
+ network: "starknet",
+ finality: "DATA_STATUS_ACCEPTED",
+ filter,
+ sinkType: "postgres",
+ sinkOptions: {
+ connectionString: Deno.env.get("POSTGRES_CONNECTION_STRING"),
+ tableName: "unrugmeme_launch"
+ }
+};
+
+export default function DecodeUnruggableMemecoinLaunch({
+ header,
+ events
+}: Block) {
+ const { blockNumber, blockHash, timestamp } = header!;
+
+ return (events ?? []).map(({ event, transaction }) => {
+ if (!event.data) return;
+
+ const transactionHash = transaction.meta.hash;
+
+ const [memecoin_address, quote_token, exchange_name] = event.data;
+
+ const exchange_name_decoded = shortString.decodeShortString(
+ exchange_name.replace(/0x0+/, "0x")
+ );
+
+ return {
+ network: "starknet-mainnet",
+ block_hash: blockHash,
+ block_number: Number(blockNumber),
+ block_timestamp: timestamp,
+ transaction_hash: transactionHash,
+ memecoin_address: memecoin_address,
+ quote_token: quote_token,
+ exchange_name: exchange_name_decoded,
+ created_at: new Date().toISOString()
+ };
+ });
+}
diff --git a/apps/indexer/src/unruggableMemecoin-transfers.indexer.js b/apps/indexer/src/unruggableMemecoin-transfers.indexer.js
deleted file mode 100644
index c5ab99fe..00000000
--- a/apps/indexer/src/unruggableMemecoin-transfers.indexer.js
+++ /dev/null
@@ -1,71 +0,0 @@
-import { Block, hash, uint256 } from './deps.js'
-import { FACTORY_ADDRESS, STARTING_BLOCK } from './constants.js'
-
-export const config = {
- filter: {
- header: { weak: true },
- events: [
- {
- fromAddress: FACTORY_ADDRESS,
- keys: [hash.getSelectorFromName('MemecoinLaunched')],
- includeReceipt: false,
- },
- ],
- },
- streamUrl: 'https://mainnet.starknet.a5a.ch',
- startingBlock: STARTING_BLOCK,
- network: 'starknet',
- finality: 'DATA_STATUS_ACCEPTED',
- sinkType: 'postgres',
- sinkOptions: {
- connectionString: '',
- tableName: 'unrugmeme_transfers',
- },
-}
-
-export function factory({ header, events }) {
- const launchEvents = (events ?? []).map(({ event }) => {
- const memecoin_address = event.data?.[0]
- return {
- fromAddress: memecoin_address,
- keys: [hash.getSelectorFromName('Transfer')],
- includeReceipt: false,
- }
- })
-
- return {
- filter: {
- header: { weak: true },
- events: launchEvents,
- },
- }
-}
-
-export default function DecodeUnruggableMemecoinLaunch({ header, events }) {
- const { blockNumber, blockHash, timestamp } = header
-
- return (events ?? []).map(({ event, transaction }) => {
- if (!event.data || !event.keys) return
-
- const transactionHash = transaction.meta.hash
- const transferId = `${transactionHash}_${event.index ?? 0}`
- const fromAddress = event.keys[1]
- const toAddress = event.keys[2]
- const amount = uint256.uint256ToBN({ low: event.data[0], high: event.data[1] })
- const memecoin_address = event.fromAddress
-
- return {
- network: 'starknet-mainnet',
- block_hash: blockHash,
- block_number: Number(blockNumber),
- block_timestamp: timestamp,
- transaction_hash: transactionHash,
- transfer_id: transferId,
- from_address: fromAddress,
- to_address: toAddress,
- memecoin_address: memecoin_address,
- amount: amount.toString(10),
- created_at: new Date().toISOString(),
- }
- })
-}
diff --git a/apps/indexer/src/unruggableMemecoin-transfers.indexer.ts b/apps/indexer/src/unruggableMemecoin-transfers.indexer.ts
new file mode 100644
index 00000000..73198cac
--- /dev/null
+++ b/apps/indexer/src/unruggableMemecoin-transfers.indexer.ts
@@ -0,0 +1,77 @@
+import { Block, hash, uint256 } from "./deps.ts";
+import { FACTORY_ADDRESS, STARTING_BLOCK } from "./constants.ts";
+
+export const config = {
+ filter: {
+ header: { weak: true },
+ events: [
+ {
+ fromAddress: FACTORY_ADDRESS,
+ keys: [hash.getSelectorFromName("MemecoinLaunched")],
+ includeReceipt: false
+ }
+ ]
+ },
+ streamUrl: "https://mainnet.starknet.a5a.ch",
+ startingBlock: STARTING_BLOCK,
+ network: "starknet",
+ finality: "DATA_STATUS_ACCEPTED",
+ sinkType: "postgres",
+ sinkOptions: {
+ connectionString: Deno.env.get("POSTGRES_CONNECTION_STRING"),
+ tableName: "unrugmeme_transfers"
+ }
+};
+
+export function factory({ header, events }: Block) {
+ const launchEvents = (events ?? []).map(({ event }) => {
+ const memecoin_address = event.data?.[0];
+ return {
+ fromAddress: memecoin_address,
+ keys: [hash.getSelectorFromName("Transfer")],
+ includeReceipt: false
+ };
+ });
+
+ return {
+ filter: {
+ header: { weak: true },
+ events: launchEvents
+ }
+ };
+}
+
+export default function DecodeUnruggableMemecoinLaunch({
+ header,
+ events
+}: Block) {
+ const { blockNumber, blockHash, timestamp } = header!;
+
+ return (events ?? []).map(({ event, transaction }) => {
+ if (!event.data || !event.keys) return;
+
+ const transactionHash = transaction.meta.hash;
+ const transferId = `${transactionHash}_${event.index ?? 0}`;
+ const fromAddress = event.keys[1];
+ const toAddress = event.keys[2];
+ const amount = uint256.uint256ToBN({
+ low: event.data[0],
+ high: event.data[1]
+ });
+ const memecoin_address = event.fromAddress;
+
+ return {
+ network: "starknet-mainnet",
+ block_hash: blockHash,
+ block_number: Number(blockNumber),
+ block_timestamp: timestamp,
+ transaction_hash: transactionHash,
+ transfer_id: transferId,
+ from_address: fromAddress,
+ to_address: toAddress,
+ memecoin_address: memecoin_address,
+ amount: amount.toString(10),
+ created_at: new Date().toISOString()
+ };
+ });
+}
diff --git a/apps/mobile/.env.example b/apps/mobile/.env.example
index 1d7b842e..b1c09129 100644
--- a/apps/mobile/.env.example
+++ b/apps/mobile/.env.example
@@ -8,3 +8,11 @@ EXPO_NODE_ENV="development"
EXPO_PUBLIC_INDEXER_BACKEND_URL=""
EXPO_PUBLIC_PIXEL_URL="http://localhost:3000/pixel"
+
+# Website Pixel UI package
+REACT_APP_BACKEND_URL=
+REACT_APP_USERNAME_STORE_CONTRACT_ADDRESS=
+REACT_APP_CANVAS_NFT_CONTRACT_ADDRESS=
+REACT_APP_USERNAME_STORE_CONTRACT_ADDRESS=
+REACT_APP_NODE_ENV=
+
diff --git a/apps/mobile/src/app/Router.tsx b/apps/mobile/src/app/Router.tsx
index b5372f7a..ce095180 100644
--- a/apps/mobile/src/app/Router.tsx
+++ b/apps/mobile/src/app/Router.tsx
@@ -1,6 +1,6 @@
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {createDrawerNavigator} from '@react-navigation/drawer';
-import {NavigationContainer} from '@react-navigation/native';
+import {NavigationContainer, useNavigation, useRoute} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {useAuth} from 'afk_nostr_sdk';
import {useEffect, useMemo, useState} from 'react';
@@ -10,6 +10,7 @@ import {Icon} from '../components';
import {Navbar} from '../components/Navbar';
import {useStyles, useTheme} from '../hooks';
import GroupChatDetail from '../modules/Group/groupDetail/GroupChatDetail';
+import GroupChatGroupRequest from '../modules/Group/memberAction/ViewRequest';
import GroupChat from '../modules/Group/message/GroupMessage';
import AuthSidebar from '../modules/Layout/auth-sidebar';
import DegensSidebar from '../modules/Layout/degens-sidebar';
@@ -45,6 +46,7 @@ import {
RootStackParams,
} from '../types';
import {retrievePublicKey} from '../utils/storage';
+import RightSidebar from '../components/RightSideBar';
const DrawerStack = createDrawerNavigator();
const RootStack = createNativeStackNavigator();
const AuthStack = createDrawerNavigator();
@@ -196,8 +198,8 @@ const AuthNavigator: React.FC = () => {
drawerContent={(props) => }
screenOptions={({navigation}) => ({
// headerShown:false,
- header: () => ,
- headerShown: false,
+ header: () => (!isDesktop ? : null),
+ headerShown: !isDesktop,
headerStyle: {
backgroundColor: theme.theme.colors.background,
},
@@ -260,6 +262,17 @@ const MainNavigator: React.FC = () => {
const theme = useTheme();
+ const FeedWithSidebar: React.FC = () => (
+
+
+
+
+
+
+
+
+ );
+
return (
{
drawerContent={(props) => }
screenOptions={({navigation}) => ({
// headerShown:false,
- header: () => ,
+ header: () => (!isDesktop ? : null),
+ headerShown: !isDesktop,
headerStyle: {
backgroundColor: theme.theme.colors.background,
},
@@ -283,10 +297,11 @@ const MainNavigator: React.FC = () => {
},
})}
>
+
{!isDesktop ? (
) : (
-
+
)}
{isDesktop && (
{
+
+
diff --git a/apps/mobile/src/assets/icons.tsx b/apps/mobile/src/assets/icons.tsx
index b1c79a34..db5bd738 100644
--- a/apps/mobile/src/assets/icons.tsx
+++ b/apps/mobile/src/assets/icons.tsx
@@ -23,6 +23,16 @@ export const AdminIcon: React.FC = (props) => (
/>
);
+
+export const EditIcon: React.FC = (props) => (
+
+);
+
export const CrownIcon: React.FC = (props) => (
);
+export const TrashIcon: React.FC = (props) => (
+
+);
+
export const RemoveIcon: React.FC = (props) => (