Skip to content

Commit

Permalink
Fix: ibc app ics20 ( develop ) (#375)
Browse files Browse the repository at this point in the history
* docs: cw721

* docs: cw20

* fix: update validator as UNSPECIFIED when not found onchain

* fix: remove token and delegator_shares when validator is UNRECOGNIZED

* feat: crawl ibc tao

* feat: add test for unrecognized validator

* feat: crawl genesis ibc tao

* feat: add migration to add index time to block, tx

* fix: code

* fix: code

* feat: ibc app

* feat: ibc app

* fix: allow whitelist query can have depth more than config (#312)

* feat: reindex cw20 service ( main ) (#277)

* feat: reindex cw20 service

* test: test cw20 reindexing

* fix: idiot

* refactor: code

* feat: api admin

* refactor: cw20/cw721 index and add relation ( main ) (#306)

* refactor: cw20 index and add relation

* refactor: code

* fix: duplicate latest migrate contract (#304)

* test: ibc app

* fix: review

* Feat/statistics (#272)

* feat: move statistic feature from v1 to v2 (not tested yet)

* feat: change job params so it can aggregate data at a specific date

* fix: query fields from exact table

* fix: query exact fields

* feat: add logger when done

* feat: finish statistic jobs (not tested)

* feat: create a separate interval job that gets the current date and create statistics jobs with date

* feat: update logic using dayjs and lodash lib

* feat: update cron jobs logic, move api actions to its service folder

* fix: query event from db and group it based on event_id and tx_id

* fix: just use a single job to query all daily data

* fix: move all queries in daily_stats job into a single Promise all

* fix: move dayjs.extend to after import statements

* fix: remove _start

* fix: only count native token in account_stats job

* feat: add api to sync stats from prev dates

* fix: support case when user just pass startDate to api

* fix: fix whitelist graphql

* fix: update column in account_statistic table, update bignum top_tx_sent

* fix: remove drop index in modify account statistic table

---------

Co-authored-by: AnDQK <[email protected]>
Co-authored-by: Phan Anh Tuan <[email protected]>

* refactor: migrate cw721 activity missing smart contract event ( main ) (#322)

* refactor: migrate cw721 activity missing smart contract event

* feat: api

* test: test params

* test: test params

* test: test params

* test: test params

* test: test params

* test: test params

* refactor: code

* refactor: code

* refactor: code

* refactor: code

* refactor: code

* fix: ci

* feat: ibc app ics20

* Fix/account stat with feegrant (#337)

* fix: get use_feegrant_grantee if has, other get tx_fee_payer

* fix: remove code not used

* Update api_gateway.service.ts (#336)

* feat: ibc ics20 send

* feat: ibc ics20 send

* feat: ibc ics20 recv

* feat: ibc ics20 recv

* feat: handle ics20 ack

* feat: handle ics20 timeout

* test: test

* fix: code

* fix: code

* feat: ibc app ics20

* feat: ibc ics20 send

* feat: ibc ics20 send

* feat: ibc ics20 recv

* feat: ibc ics20 recv

* feat: handle ics20 ack

* feat: handle ics20 timeout

* test: test

* fix: code

* fix: code

* fix: cw721 activity missing from/to ( main ) (#294)

* fix: cw721 activity missing from/to

* fix: fill from/to cw721 activity

* fix: fill from/to cw721 activity

* fix: fill from/to cw721 activity

* fix: fill from/to cw721 activity

* refactor: code

* fix: code

* refactor: code

---------

Co-authored-by: Vu Ngoc Quang <[email protected]>

* feat: crawl ibc tao ( main ) (#278)

* feat: crawl ibc tao

* feat: crawl genesis ibc tao

* fix: code

* fix: code

* refactor: code

* fix: test

* refactor: code

* fix: merge code

* refactor: review code

* refactor: review code

* Fix/lint json file (#359)

* fix: display json on multiple lines

* fix: update launch.json to debug jest in 1 file; use moleculer.config.ts when debug service

* Feat/ibc app ( main ) (#321)

* feat: crawl ibc tao

* feat: crawl genesis ibc tao

* fix: code

* fix: code

* feat: ibc app

* feat: ibc app

* test: ibc app

* fix: review

* refactor: update status

* refactor: code

* fix: excessive data

* feat: add memo column

---------

Co-authored-by: Tuan Phan Anh <[email protected]>
Co-authored-by: Phan Anh Tuan <[email protected]>
Co-authored-by: Vu Ngoc Quang <[email protected]>
Co-authored-by: AnDQK <[email protected]>
  • Loading branch information
5 people authored Sep 22, 2023
1 parent 0397754 commit cd66018
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
13 changes: 13 additions & 0 deletions migrations/20230922031341_ibc_ics20_add_memo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Knex } from 'knex';

export async function up(knex: Knex): Promise<void> {
await knex.schema.alterTable('ibc_ics20', (table) => {
table.string('memo').defaultTo('');
});
}

export async function down(knex: Knex): Promise<void> {
await knex.schema.alterTable('ibc_ics20', (table) => {
table.dropColumn('memo');
});
}
1 change: 1 addition & 0 deletions src/models/event_attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export class EventAttribute extends BaseModel {
REFUND_RECEIVER: 'refund_receiver',
REFUND_DENOM: 'refund_denom',
REFUND_AMOUNT: 'refund_amount',
MEMO: 'memo',
};

static ATTRIBUTE_COMPOSITE_KEY = {
Expand Down
2 changes: 2 additions & 0 deletions src/models/ibc_ics20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export class IbcIcs20 extends BaseModel {

type!: string;

memo!: string;

static get tableName() {
return 'ibc_ics20';
}
Expand Down
13 changes: 11 additions & 2 deletions src/services/ibc/crawl_ibc_ics20.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Service } from '@ourparentcenter/moleculer-decorators-extended';
import { Knex } from 'knex';
import { ServiceBroker } from 'moleculer';
import _ from 'lodash';
import config from '../../../config.json' assert { type: 'json' };
import BullableService, { QueueHandler } from '../../base/bullable.service';
import { BULL_JOB_NAME, SERVICE } from '../../common';
Expand Down Expand Up @@ -67,7 +68,13 @@ export default class CrawlIBCIcs20Service extends BullableService {
const ibcIcs20s = ics20Sends.map((msg) =>
IbcIcs20.fromJson({
ibc_message_id: msg.id,
...msg.data,
..._.pick(msg.data, [
'sender',
'receiver',
'amount',
'denom',
'memo',
]),
channel_id: msg.src_channel_id,
status: IbcIcs20.STATUS_TYPE.ONGOING,
sequence_key: msg.sequence_key,
Expand Down Expand Up @@ -107,13 +114,14 @@ export default class CrawlIBCIcs20Service extends BullableService {
if (recvEvent === undefined) {
throw Error(`Recv ibc hasn't emmitted events: ${msg.id}`);
}
const [sender, receiver, amount, originalDenom, ackStatus] =
const [sender, receiver, amount, originalDenom, ackStatus, memo] =
recvEvent.getAttributesFrom([
EventAttribute.ATTRIBUTE_KEY.SENDER,
EventAttribute.ATTRIBUTE_KEY.RECEIVER,
EventAttribute.ATTRIBUTE_KEY.AMOUNT,
EventAttribute.ATTRIBUTE_KEY.DENOM,
EventAttribute.ATTRIBUTE_KEY.SUCCESS,
EventAttribute.ATTRIBUTE_KEY.MEMO,
]);
if (originalDenom === undefined) {
throw Error(`Recv ibc hasn't emit denom: ${msg.id}`);
Expand Down Expand Up @@ -141,6 +149,7 @@ export default class CrawlIBCIcs20Service extends BullableService {
channel_id: msg.dst_channel_id,
sequence_key: msg.sequence_key,
type: msg.type,
memo,
});
});
await IbcIcs20.query().insert(ibcIcs20s).transacting(trx);
Expand Down

0 comments on commit cd66018

Please sign in to comment.