From ea31d0bfd989344a55754e7277efd86ef7a1cd10 Mon Sep 17 00:00:00 2001 From: scorpiotzh <835598264@qq.com> Date: Wed, 15 Nov 2023 15:03:15 +0800 Subject: [PATCH] feat: Update token info --- dao/dao.go | 38 +++++++++++++++++++++++++++++++------ dao/dao_token_price_info.go | 2 ++ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/dao/dao.go b/dao/dao.go index 656a7a7..71bdd4b 100644 --- a/dao/dao.go +++ b/dao/dao.go @@ -90,12 +90,14 @@ func Initialize(db *gorm.DB) (*DbDao, error) { if err := tx.Model(TableTokenPriceInfo{}). Where("token_id=?", tokenList[i].TokenId). Updates(map[string]interface{}{ - "chain_type": tokenList[i].ChainType, - "name": tokenList[i].Name, - "symbol": tokenList[i].Symbol, - "decimals": tokenList[i].Decimals, - "logo": tokenList[i].Logo, - "coin_type": tokenList[i].CoinType, + "chain_type": tokenList[i].ChainType, + "name": tokenList[i].Name, + "symbol": tokenList[i].Symbol, + "decimals": tokenList[i].Decimals, + "logo": tokenList[i].Logo, + "coin_type": tokenList[i].CoinType, + "display_name": tokenList[i].DisplayName, + "icon": tokenList[i].Icon, }).Error; err != nil { return err } @@ -120,6 +122,8 @@ var tokenList = []TableTokenPriceInfo{ Decimals: 8, Logo: "https://app.did.id/images/components/portal-wallet.svg", LastUpdatedAt: time.Now().Unix(), + DisplayName: ".bit Balance", + Icon: "dotbit-balance", }, { TokenId: "eth_eth", @@ -131,6 +135,8 @@ var tokenList = []TableTokenPriceInfo{ Decimals: 18, Logo: "https://app.did.id/images/components/ethereum.svg", LastUpdatedAt: time.Now().Unix(), + DisplayName: "Ethereum", + Icon: "ethereum", }, { TokenId: "btc_btc", @@ -142,6 +148,8 @@ var tokenList = []TableTokenPriceInfo{ Decimals: 8, Logo: "https://app.did.id/images/components/bitcoin.svg", LastUpdatedAt: time.Now().Unix(), + DisplayName: "Bitcoin", + Icon: "", }, { TokenId: "tron_trx", @@ -153,6 +161,8 @@ var tokenList = []TableTokenPriceInfo{ Decimals: 6, Logo: "https://app.did.id/images/components/tron.svg", LastUpdatedAt: time.Now().Unix(), + DisplayName: "TRON", + Icon: "tron", }, { TokenId: "bsc_bnb", @@ -164,6 +174,8 @@ var tokenList = []TableTokenPriceInfo{ Decimals: 18, Logo: "https://app.did.id/images/components/binance-smart-chain.svg", LastUpdatedAt: time.Now().Unix(), + DisplayName: "Binance", + Icon: "binance-smart-chain", }, { TokenId: "polygon_matic", @@ -175,6 +187,8 @@ var tokenList = []TableTokenPriceInfo{ Decimals: 18, Logo: "https://app.did.id/images/components/polygon.svg", LastUpdatedAt: time.Now().Unix(), + DisplayName: "Polygon", + Icon: "polygon", }, { TokenId: "doge_doge", @@ -186,6 +200,8 @@ var tokenList = []TableTokenPriceInfo{ Decimals: 8, Logo: "https://app.did.id/images/components/doge.svg", LastUpdatedAt: time.Now().Unix(), + DisplayName: "Dogecoin", + Icon: "dogecoin", }, { TokenId: "eth_erc20_usdt", @@ -198,6 +214,8 @@ var tokenList = []TableTokenPriceInfo{ Logo: "", Price: decimal.NewFromInt(1), LastUpdatedAt: time.Now().Unix(), + DisplayName: "Ethereum", + Icon: "ethereum", }, { TokenId: "bsc_bep20_usdt", @@ -210,6 +228,8 @@ var tokenList = []TableTokenPriceInfo{ Logo: "", Price: decimal.NewFromInt(1), LastUpdatedAt: time.Now().Unix(), + DisplayName: "Binance", + Icon: "binance-smart-chain", }, { TokenId: "tron_trc20_usdt", @@ -222,6 +242,8 @@ var tokenList = []TableTokenPriceInfo{ Logo: "", Price: decimal.NewFromInt(1), LastUpdatedAt: time.Now().Unix(), + DisplayName: "TRON", + Icon: "tron", }, { TokenId: "stripe_usd", @@ -233,6 +255,8 @@ var tokenList = []TableTokenPriceInfo{ Logo: "", Price: decimal.NewFromInt(1), LastUpdatedAt: time.Now().Unix(), + DisplayName: "by stripe", + Icon: "stripe", }, { TokenId: "did_point", @@ -244,6 +268,8 @@ var tokenList = []TableTokenPriceInfo{ Logo: "", Price: decimal.NewFromInt(1), LastUpdatedAt: time.Now().Unix(), + DisplayName: "DIDPoint", + Icon: "didpoint", }, } diff --git a/dao/dao_token_price_info.go b/dao/dao_token_price_info.go index 10f3d81..63747e9 100644 --- a/dao/dao_token_price_info.go +++ b/dao/dao_token_price_info.go @@ -25,6 +25,8 @@ type TableTokenPriceInfo struct { MarketCap decimal.Decimal `json:"market_cap" gorm:"column:market_cap;type:decimal(50, 8) NOT NULL DEFAULT '0.00000000' COMMENT ''"` LastUpdatedAt int64 `json:"last_updated_at" gorm:"column:last_updated_at;type:bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT ''"` Status int `json:"status" gorm:"column:status;type:smallint(6) NOT NULL DEFAULT '0' COMMENT '0: normal 1: banned'"` + Icon string `json:"icon" gorm:"column:icon; type:varchar(255) NOT NULL DEFAULT '' COMMENT '';"` + DisplayName string `json:"display_name" gorm:"column:display_name; type:varchar(255) NOT NULL DEFAULT '' COMMENT '';"` CreatedAt time.Time `json:"created_at" gorm:"column:created_at;type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''"` UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ''"` }