-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/merge erc20 from develop to evm (#878)
* feat: merge erc20 from develop to evm * feat: merge erc20 from develop to evm
- Loading branch information
1 parent
c046f76
commit ace881d
Showing
16 changed files
with
1,459 additions
and
590 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
migrations/evm/20240702013020_add_col_to_save_cosmos_erc20.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Knex } from 'knex'; | ||
import { Erc20Activity } from '../../src/models'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
await knex.schema.alterTable(Erc20Activity.tableName, (table) => { | ||
table.bigint('cosmos_event_id').index(); | ||
table.integer('cosmos_tx_id').index(); | ||
table.setNullable('evm_event_id'); | ||
}); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await knex.schema.alterTable(Erc20Activity.tableName, (table) => { | ||
table.dropColumn('cosmos_event_id'); | ||
table.dropColumn('cosmos_tx_id'); | ||
table.dropNullable('evm_event_id'); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Post, Service } from '@ourparentcenter/moleculer-decorators-extended'; | ||
import { Context, ServiceBroker } from 'moleculer'; | ||
import networks from '../../../network.json' assert { type: 'json' }; | ||
import BaseService from '../../base/base.service'; | ||
|
||
@Service({ | ||
name: 'erc20-admin', | ||
version: 1, | ||
}) | ||
export default class Erc20AdminService extends BaseService { | ||
public constructor(public broker: ServiceBroker) { | ||
super(broker); | ||
} | ||
|
||
@Post('/erc20-reindexing', { | ||
name: 'erc20Reindexing', | ||
params: { | ||
chainid: { | ||
type: 'string', | ||
optional: false, | ||
enum: networks.map((network) => network.chainId), | ||
}, | ||
addresses: { | ||
type: 'array', | ||
optional: false, | ||
items: 'string', | ||
}, | ||
}, | ||
}) | ||
async erc20Reindexing( | ||
ctx: Context< | ||
{ | ||
chainid: string; | ||
addresses: string[]; | ||
}, | ||
Record<string, unknown> | ||
> | ||
) { | ||
const selectedChain = networks.find( | ||
(network) => network.chainId === ctx.params.chainid | ||
); | ||
return this.broker.call( | ||
`v1.Erc20.reindexing@${selectedChain?.moleculerNamespace}`, | ||
{ | ||
addresses: ctx.params.addresses, | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.