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

Feat/ibc app ics20 ( develop ) #343

Merged
merged 73 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
45fa9b4
docs: cw721
phamphong9981 Jul 5, 2023
b27aa4c
docs: cw20
phamphong9981 Jul 7, 2023
ccc8fbd
Merge branch 'main' into docs/cw721
fibonacci998 Jul 10, 2023
0fa8225
Merge branch 'main' into docs/cw20
fibonacci998 Jul 10, 2023
5e50079
fix: update validator as UNSPECIFIED when not found onchain
fibonacci998 Jul 31, 2023
147fb9b
fix: remove token and delegator_shares when validator is UNRECOGNIZED
fibonacci998 Aug 1, 2023
dde6426
feat: crawl ibc tao
phamphong9981 Aug 2, 2023
6fd8005
feat: add test for unrecognized validator
fibonacci998 Aug 3, 2023
6db3990
feat: crawl genesis ibc tao
phamphong9981 Aug 4, 2023
d8eb803
feat: add migration to add index time to block, tx
fibonacci998 Aug 7, 2023
928e7b9
fix: code
phamphong9981 Aug 7, 2023
f38720d
Merge pull request #289 from aura-nw/feat/ibc_tao_genesis
phamphong9981 Aug 7, 2023
454a38a
fix: code
phamphong9981 Aug 8, 2023
49ad0b2
Merge pull request #293 from aura-nw/feat/add-index-by-time-to-block-tx
peara Aug 9, 2023
a901780
Merge pull request #276 from aura-nw/fix/update-validator-not-found
peara Aug 9, 2023
49bcd7c
Merge pull request #249 from aura-nw/docs/cw20
peara Aug 9, 2023
6924407
Merge pull request #243 from aura-nw/docs/cw721
peara Aug 9, 2023
2f4cc12
feat: ibc app
phamphong9981 Aug 11, 2023
fc2478d
feat: ibc app
phamphong9981 Aug 11, 2023
32d103a
fix: allow whitelist query can have depth more than config (#312)
fibonacci998 Aug 15, 2023
685bb4b
feat: reindex cw20 service ( main ) (#277)
phamphong9981 Aug 16, 2023
92795eb
refactor: cw20/cw721 index and add relation ( main ) (#306)
phamphong9981 Aug 16, 2023
b6b007c
fix: duplicate latest migrate contract (#304)
phamphong9981 Aug 16, 2023
3640cff
test: ibc app
phamphong9981 Aug 16, 2023
4344974
Merge branch 'main' of github.com:aura-nw/horoscope-v2 into feat/ibc_app
phamphong9981 Aug 16, 2023
a5a406a
fix: review
phamphong9981 Aug 21, 2023
887ecfd
Feat/statistics (#272)
peara Aug 22, 2023
8c01c5c
refactor: migrate cw721 activity missing smart contract event ( main …
phamphong9981 Aug 23, 2023
4b36f2e
feat: ibc app ics20
phamphong9981 Aug 23, 2023
3c325dc
Fix/account stat with feegrant (#337)
fibonacci998 Aug 23, 2023
4adfdf0
Update api_gateway.service.ts (#336)
fibonacci998 Aug 23, 2023
be9a80d
feat: ibc ics20 send
phamphong9981 Aug 24, 2023
a67e9f0
Merge branch 'main' of github.com:aura-nw/horoscope-v2 into feat/ibc_…
phamphong9981 Aug 24, 2023
91e03ce
feat: ibc ics20 send
phamphong9981 Aug 24, 2023
1d438ea
feat: ibc ics20 recv
phamphong9981 Aug 24, 2023
eab1ff1
feat: ibc ics20 recv
phamphong9981 Aug 24, 2023
6cd21c3
feat: handle ics20 ack
phamphong9981 Aug 25, 2023
3252d7c
feat: handle ics20 timeout
phamphong9981 Aug 25, 2023
93c2622
test: test
phamphong9981 Aug 25, 2023
a439d90
fix: code
phamphong9981 Aug 28, 2023
d7b5ea2
fix: code
phamphong9981 Aug 28, 2023
1cab04a
feat: ibc app ics20
phamphong9981 Aug 23, 2023
d6277cc
feat: ibc ics20 send
phamphong9981 Aug 24, 2023
3e5301b
feat: ibc ics20 send
phamphong9981 Aug 24, 2023
e13d572
feat: ibc ics20 recv
phamphong9981 Aug 24, 2023
e560026
feat: ibc ics20 recv
phamphong9981 Aug 24, 2023
44363b8
feat: handle ics20 ack
phamphong9981 Aug 25, 2023
0cd9a16
feat: handle ics20 timeout
phamphong9981 Aug 25, 2023
c27556d
test: test
phamphong9981 Aug 25, 2023
ec38e36
fix: code
phamphong9981 Aug 28, 2023
a61ca2b
fix: code
phamphong9981 Aug 28, 2023
5c86a9f
fix: cw721 activity missing from/to ( main ) (#294)
phamphong9981 Aug 28, 2023
dcec038
feat: crawl ibc tao ( main ) (#278)
phamphong9981 Aug 28, 2023
7b8d852
refactor: code
phamphong9981 Aug 29, 2023
a5f4afc
fix: test
phamphong9981 Aug 29, 2023
0c7e603
refactor: code
phamphong9981 Aug 29, 2023
4586cf5
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 Aug 29, 2023
e37e210
fix: merge code
phamphong9981 Aug 29, 2023
2da7bd4
refactor: review code
phamphong9981 Sep 5, 2023
8c075f2
refactor: review code
phamphong9981 Sep 5, 2023
e8893da
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 Sep 5, 2023
2f1b208
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 Sep 5, 2023
e19387a
Fix/lint json file (#359)
fibonacci998 Sep 8, 2023
ce28ddd
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 Sep 12, 2023
49cc97d
Feat/ibc app ( main ) (#321)
phamphong9981 Sep 14, 2023
7ad5fe9
refactor: update status
phamphong9981 Sep 15, 2023
aca7828
Merge branch 'main' of github.com:aura-nw/horoscope-v2 into feat/ibc_…
phamphong9981 Sep 15, 2023
964adc1
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 Sep 15, 2023
64615ee
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 Sep 15, 2023
0fe2af1
refactor: code
phamphong9981 Sep 19, 2023
972632d
Merge branch 'feat/ibc_app_ics20' of github.com:aura-nw/horoscope-v2 …
phamphong9981 Sep 19, 2023
635169c
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 Sep 21, 2023
66881ec
Merge branch 'develop' of github.com:aura-nw/horoscope-v2 into feat/i…
phamphong9981 Sep 21, 2023
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
6 changes: 6 additions & 0 deletions ci/config.json.ci
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@
"millisecondRepeatJob": 2000,
"blocksPerCall": 100
},
"crawlIbcIcs20": {
"key": "crawlIbcIcs20",
"millisecondRepeatJob": 2000,
"blocksPerCall": 100,
"port": "transfer"
},
"jobReassignMsgIndexToEvent": {
"millisecondCrawl": 1000,
"blocksPerCall": 100
Expand Down
6 changes: 6 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@
"millisecondRepeatJob": 2000,
"blocksPerCall": 100
},
"crawlIbcIcs20": {
"key": "crawlIbcIcs20",
"millisecondRepeatJob": 2000,
"blocksPerCall": 100,
"port": "transfer"
},
"jobReassignMsgIndexToEvent": {
"millisecondCrawl": 1000,
"blocksPerCall": 100
Expand Down
21 changes: 21 additions & 0 deletions migrations/20230823070516_ics20_model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Knex } from 'knex';

export async function up(knex: Knex): Promise<void> {
await knex.schema.createTable('ibc_ics20', (table) => {
peara marked this conversation as resolved.
Show resolved Hide resolved
table.increments();
table.integer('ibc_message_id').notNullable().unique();
table.string('sender').index();
table.string('receiver').index().notNullable();
table.decimal('amount', 80, 0).notNullable();
table.string('denom').notNullable().index();
table.string('status').notNullable();
table.string('channel_id').notNullable().index();
table.foreign('ibc_message_id').references('ibc_message.id');
table.string('sequence_key').notNullable().index();
table.string('type').notNullable().index();
});
}

export async function down(knex: Knex): Promise<void> {
await knex.schema.dropTableIfExists('ibc_ics20');
}
5 changes: 5 additions & 0 deletions src/common/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const BULL_JOB_NAME = {
REINDEX_CW20_CONTRACT: 'reindex:cw20-contract',
REINDEX_CW20_HISTORY: 'reindex:cw20-history',
CRAWL_IBC_APP: 'crawl:ibc-app',
CRAWL_IBC_ICS20: 'crawl:ibc-ics20',
JOB_REASSIGN_MSG_INDEX_TO_EVENT: 'job:reassign-msg-index-to-event',
JOB_CREATE_COMPOSITE_INDEX_ATTR_PARTITION:
'job:create-index-composite-attr-partition',
Expand Down Expand Up @@ -284,6 +285,10 @@ export const SERVICE = {
path: 'v1.Cw20ReindexingService.reindexing',
},
},
CrawlIBCIcs20Service: {
key: 'CrawlIBCIcs20Service',
name: 'v1.CrawlIBCIcs20Service',
},
ServicesManager: {
key: 'ServicesManager',
name: 'v1.ServicesManager',
Expand Down
7 changes: 7 additions & 0 deletions src/models/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ export class Event extends BaseModel {
};
}

getAttributesFrom(attributesType: string[]) {
return attributesType.map(
(attributeType) =>
this.attributes?.find((attr: any) => attr.key === attributeType)?.value
);
}

static EVENT_TYPE = {
STORE_CODE: 'store_code',
SUBMIT_PROPOSAL: 'submit_proposal',
Expand Down
5 changes: 5 additions & 0 deletions src/models/event_attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ export class EventAttribute extends BaseModel {
SRC_CHANNEL: 'packet_src_channel',
DST_PORT: 'packet_dst_port',
DST_CHANNEL: 'packet_dst_channel',
DENOM: 'denom',
SUCCESS: 'success',
REFUND_RECEIVER: 'refund_receiver',
REFUND_DENOM: 'refund_denom',
REFUND_AMOUNT: 'refund_amount',
};

static ATTRIBUTE_COMPOSITE_KEY = {
Expand Down
93 changes: 93 additions & 0 deletions src/models/ibc_ics20.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/* eslint-disable import/no-cycle */
import { Model } from 'objection';
import BaseModel from './base';
import { IbcMessage } from './ibc_message';
import { IbcChannel } from './ibc_channel';

export class IbcIcs20 extends BaseModel {
id!: number;

ibc_message_id!: number;

sender!: string;

receiver!: string;

amount!: string;

denom!: string;

status!: string;

channel_id!: string;

ibc_message!: IbcMessage;

sequence_key!: string;

type!: string;

static get tableName() {
return 'ibc_ics20';
}

static get jsonSchema() {
return {
type: 'object',
required: [
'receiver',
'amount',
'denom',
'ibc_message_id',
'channel_id',
'sequence_key',
'status',
'type',
],
properties: {
receiver: { type: 'string' },
denom: { type: 'string' },
ibc_message_id: { type: 'number' },
amount: { type: 'string' },
channel_id: { type: 'string' },
sequence_key: { type: 'string' },
status: { type: 'string' },
type: { type: 'string' },
},
};
}

static get relationMappings() {
return {
ibc_message: {
relation: Model.BelongsToOneRelation,
modelClass: IbcMessage,
join: {
from: 'ibc_ics20.ibc_message_id',
to: 'ibc_message.id',
},
},
channel: {
relation: Model.BelongsToOneRelation,
modelClass: IbcChannel,
join: {
from: 'ibc_ics20.channel_id',
to: 'ibc_channel.channel_id',
},
},
};
}

static EVENT_TYPE = {
TIMEOUT: 'timeout',
FUNGIBLE_TOKEN_PACKET: 'fungible_token_packet',
DENOM_TRACE: 'denomination_trace',
};

static STATUS_TYPE = {
TIMEOUT: 'timeout',
ACK_ERROR: 'ack_error',
ACK_SUCCESS: 'ack_success',
ONGOING: 'ongoing',
};
}
7 changes: 7 additions & 0 deletions src/models/ibc_message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Model } from 'objection';
import BaseModel from './base';
import { IbcChannel } from './ibc_channel';
import { TransactionMessage } from './transaction_message';
import config from '../../config.json' assert { type: 'json' };

export class IbcMessage extends BaseModel {
id!: number;
Expand All @@ -25,6 +26,8 @@ export class IbcMessage extends BaseModel {

data!: any;

message!: TransactionMessage;

static get tableName() {
return 'ibc_message';
}
Expand Down Expand Up @@ -90,4 +93,8 @@ export class IbcMessage extends BaseModel {
ACKNOWLEDGE_PACKET: 'acknowledge_packet',
TIMEOUT_PACKET: 'timeout_packet',
};

static PORTS = {
ICS20: config.crawlIbcIcs20.port,
};
}
1 change: 1 addition & 0 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ export * from './ibc_client';
export * from './ibc_connection';
export * from './ibc_channel';
export * from './ibc_message';
export * from './ibc_ics20';
2 changes: 2 additions & 0 deletions src/models/transaction_message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export class TransactionMessage extends BaseModel {

parent_id!: number;

events!: Event[];

static get tableName() {
return 'transaction_message';
}
Expand Down
Loading
Loading