Skip to content

Commit

Permalink
Merge pull request #825 from aura-nw/baseline/main_20230622
Browse files Browse the repository at this point in the history
Baseline/main 20230622
  • Loading branch information
nhphuc2411 authored Jun 23, 2023
2 parents 1c141a0 + 10015ee commit 278e019
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
LENGTH,
SoulboundToken,
SYNC_CONTRACT_TRANSACTION_TYPE,
TokenMarkets,
Transaction,
} from '../../../shared';
import { Cw721TokenParamsDto } from '../../cw721-token/dtos/cw721-token-params.dto';
Expand Down Expand Up @@ -122,6 +123,11 @@ export class SmartContractRepository extends Repository<SmartContract> {
async getContractsByContractAddress(contractAddress: string) {
return await this.createQueryBuilder('sc')
.leftJoin(SmartContractCode, 'scc', 'sc.code_id = scc.code_id')
.leftJoin(
TokenMarkets,
'tkm',
'sc.contract_address = tkm.contract_address',
)
.select([
'sc.*',
'scc.type `type`',
Expand All @@ -135,6 +141,8 @@ export class SmartContractRepository extends Repository<SmartContract> {
'scc.execute_msg_schema `execute_msg_schema`',
'scc.contract_hash `contract_hash`',
'scc.s3_location `s3_location`',
'tkm.verify_status `verify_status`',
'tkm.verify_text `verify_text`',
])
.orderBy('sc.updated_at', 'DESC')
.where('sc.contract_address = :contract_address', {
Expand Down
2 changes: 2 additions & 0 deletions src/components/contract/services/contract.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ export class ContractService {
token.max_total_supply * token.price;
token.price_change_percentage_24h =
tokenMarketData?.price_change_percentage_24h || 0;
token.verify_status = tokenMarketData?.verify_status || '';
token.verify_text = tokenMarketData?.verify_text || '';
token.num_holder = 0;
token.holders_change_percentage_24h = 0;

Expand Down
2 changes: 2 additions & 0 deletions src/components/cw20-token/dtos/asset.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ export class AssetDto {
value = '';
denom = '';
decimals = 0;
verify_status = '';
verify_text = '';
}
6 changes: 6 additions & 0 deletions src/components/cw20-token/services/cw20-token.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export class Cw20TokenService {
name: item.name || '',
symbol: item.symbol || '',
image: item.image || '',
verify_status: item.verify_status || '',
verify_text: item.verify_text || '',
description: item.description || '',
circulating_market_cap: circulating_market_cap,
volume_24h: item.total_volume || 0,
Expand Down Expand Up @@ -136,6 +138,8 @@ export class Cw20TokenService {
assetDto.image = AURA_INFO.IMAGE;
assetDto.denom = this.minimalDenom;
assetDto.decimals = this.decimals;
assetDto.verify_text = 'Verified by Aura Network';
assetDto.verify_status = 'VERIFIED';

//get balance
const [totalBalances, tokenData] = await Promise.all([
Expand Down Expand Up @@ -234,6 +238,8 @@ export class Cw20TokenService {
const asset = new AssetDto();
asset.contract_address = item.contract_address || '-';
asset.image = tokenMarketsInfo?.image || '';
asset.verify_status = tokenMarketsInfo?.verify_status || '';
asset.verify_text = tokenMarketsInfo?.verify_text || '';
asset.name = item.asset_info?.data?.name || '';
asset.symbol = item.asset_info?.data?.symbol || '';
asset.decimals = item.asset_info?.data?.decimals || 0;
Expand Down
23 changes: 23 additions & 0 deletions src/migrations/1687417991360-add-verify-cw20-column.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class addVerifyCw20Column1687417991360 implements MigrationInterface {
name = 'addVerifyCw20Column1687417991360';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE \`token_markets\` ADD \`verify_status\` varchar(255) NULL`,
);
await queryRunner.query(
`ALTER TABLE \`token_markets\` ADD \`verify_text\` text NULL`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE \`token_markets\` DROP COLUMN \`verify_text\``,
);
await queryRunner.query(
`ALTER TABLE \`token_markets\` DROP COLUMN \`verify_status\``,
);
}
}
6 changes: 6 additions & 0 deletions src/shared/entities/token-markets.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,10 @@ export class TokenMarkets extends BaseEntityIncrementId {
default: 0,
})
fully_diluted_valuation: number;

@Column({ name: 'verify_status', nullable: true })
verify_status: string;

@Column({ name: 'verify_text', nullable: true })
verify_text: string;
}

0 comments on commit 278e019

Please sign in to comment.